Hi all I'm developing an app in xcode for iPhone. i've many label in that it looks good when orientation is Portrait but when it is landscape all labels will overlap on each other, so i want to make it as scrollable screen only when it is in landscape mode. please help me Thanks in Advance.
Asked
Active
Viewed 1,394 times
0
-
Is this iOS? If so tag it 'ios'. – trojanfoe Sep 12 '12 at 09:00
-
hundreds of questions asked for this, have you googled the issue, also this is quite wide question. check out these threads - http://stackoverflow.com/questions/10696819/orientation-handling-in-interface-builder, http://stackoverflow.com/questions/11075600/handling-ios-device-orientation – rishi Sep 12 '12 at 09:02
-
ya it is. I'm developing on ios5 – Muddu Patil Sep 12 '12 at 09:02
1 Answers
0
Add UIScrollView in self.view.
Now set frame of yourScrollView according to orientation and its content size according to it. But in protrait frame and content size will be equal so there will be no scrolling.
Now in landscape, frame and content size will be not be equal so there will be scrolling
Note : Adjust UIlements's fame according to orientation
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
if(UIInterfaceOrientationIsLandscape(interfaceOrientation))
{
[yourScrollView setFrame:CGRectMake(0,0,320,460)];
[yourScrollView setContentSize:CGSizeMake(320,460)];
//change frame of UIELement(labels) here according to orientation
}
else
{
[yourScrollView setFrame:CGRectMake(0,0,480,300)];
[yourScrollView setContentSize:CGSizeMake(480,460)];
//change frame of UIELement(labels) here according to orientation
}
return YES;
}

Paresh Navadiya
- 38,095
- 11
- 81
- 132