Is here any way to set UIScrollview orientation by coding? Actually I am creating scrollview programmatically and want to set its orientation landscape. I can't find any way on google and apple's docs.
Asked
Active
Viewed 473 times
0
-
check out this [link](http://stackoverflow.com/questions/2998336/how-to-create-a-uiscrollview-programmatically) – punter Dec 31 '12 at 08:05
-
This link does not help about orientation. – NightFury Dec 31 '12 at 08:10
1 Answers
0
With scrollviews, you don't give them an orientation exactly. You set their frame and their content size. So if you set the frame to 1024 x 768 and the content size is 3000 x 768, the scrollview will automatically allow scrolling horizontally. And because you set the frame to a landscape ratio/size, the scrollview will be in a landscape "orientation." Pseudo code below to help.
UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0,0,1024,768)];
[scrollView setContentSize:CGSizeMake(3000, 768)];
Let me know if this doesn't help and I can elaborate or help further.

Jason Grandelli
- 342
- 3
- 10