【发布时间】:2011-05-25 21:02:16
【问题描述】:
我有一个简单的页面,顶部有导航栏,底部有标签栏,中间有一个滚动视图。滚动视图包含一个标签和图像以及一个不可滚动的文本视图,该文本视图动态填充文本并适当调整大小。我一直在尝试通过以下方式使其在横向上工作:
-(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
if(toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft || toInterfaceOrientation == UIInterfaceOrientationLandscapeRight)
{
NSLog(@"called");
navBar.frame = CGRectMake(0, 0, 480, 32);
sview.frame = CGRectMake(0, 32, 480, 240);
}
else {
navBar.frame = CGRectMake(0, 0, 320, 44);
sview.frame = CGRectMake(0, 44, 320, 372);
}
}
这让我非常接近,因为导航栏和滚动视图正确调整大小并且滚动良好,但滚动视图中的内容偏向左侧。如何重绘内容以在滚动视图中正确排列?
【问题讨论】:
-
你试过设置自动调整掩码吗?
-
我不确定上述方法和 autoresizemask 掩码如何协同工作。我觉得当我开始用这种方法重绘东西时,面具会停止应用,但我对这一切还是很陌生。我会更改子视图或滚动视图的掩码吗?
标签: objective-c uiscrollview orientation