2010-09-24 46 views
2

所以我有一个简单的分割视图,除了当视图加载时功能很好。由于某种原因,如果它在横向模式下加载,它只会加载到屏幕的一半左右(它好像是纵向模式的宽度)。有谁知道可能会导致这种行为?我使用的是由Apple SDK提供的默认分割视图控制器。 alt textiPad分离显示负载很奇怪

这是我正在谈论的图像。在我看来,我没有做任何特别的事情,并且正确地在IB中连接了事物。我有点茫然,任何帮助都会很棒。谢谢!

+0

您正在使用哪个SDK?我以前见过最新的(3.4.5)。 – MishieMoo 2010-09-24 18:59:28

回答

1

想通了:

我在显示加载屏幕后加载视图。因此它没有正确检测到方向。我在将视图添加到窗口之前添加了此手动检查,并解决了我的问题。

CGRect frame = [[UIScreen mainScreen] applicationFrame]; 

switch(controller.interfaceOrientation){ 
    case UIInterfaceOrientationPortrait: 
    case UIInterfaceOrientationPortraitUpsideDown: 
     [controller.view setFrame:frame]; 
     break; 
    case UIInterfaceOrientationLandscapeLeft: 
    case UIInterfaceOrientationLandscapeRight: 
     [controller.view setFrame:CGRectMake(frame.origin.x, frame.origin.y, frame.size.height, frame.size.width)]; 
     break; 
}