旋转后,视图不适合屏幕

时间:2011-10-22 08:08:56

标签: iphone objective-c ios uiscrollview autorotate

虽然在模拟器中问题不存在,但是在自动旋转到横向方向后我的视图出现问题。当我以纵向加载应用程序时,一切正常,但是当我将设备(iPod touch 1st gen.3.1.3)旋转到横向时,结果是:http://imageshack.us/photo/my-images/155/img0021n.png/。 如果我切换到第二个视图(“Riepilogo”,即表视图),然后回到第一个视图,视图完全适合横向,但如果我再次旋转到纵向,问题与上面相同。

以下是shouldAutorotateToInterfaceOrientation的代码:

- (BOOL)shouldAutorotateToInterfaceOrientation(UIInterfaceOrientation)interfaceOrientation{
if (interfaceOrientation==UIInterfaceOrientationLandscapeLeft || interfaceOrientation==UIInterfaceOrientationLandscapeRight) {

    [self.scrollView setContentSize: CGSizeMake(480,416)]; 

} else {

    [self.scrollView setContentSize: CGSizeMake(320, 416)];

}

return (interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight); }

P.S。该视图是UIScrollView的实例

1 个答案:

答案 0 :(得分:0)

调整滚动视图的大小不会调整其内容的大小。