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.
问问题
1377 次
1 回答
0
在 self.view 中添加UIScrollView。
现在根据方向设置 yourScrollView 的框架,并根据它的内容大小。但是在纵向框架和内容大小将相等,因此不会滚动。
现在在横向中,框架和内容大小将不相等,因此会有滚动
注意:根据方向调整 UIlements 的名气
- (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;
}
于 2012-09-12T09:07:19.040 回答