2

这是在我的 AppDelegate 中,并在方向更改时运行。当应用程序加载时,它总是以纵向模式加载。如果我在设备处于横向模式时加载应用程序,这仍然会像设备处于纵向模式一样执行。这是我遇到的第一个问题。第二个是加载后,当我将设备从纵向旋转到横向时,会出现断线,如下所示:

-(void)setOrientationView
{

    UIDevice *currentDevice = [UIDevice currentDevice];
    [currentDevice endGeneratingDeviceOrientationNotifications];
    UIDeviceOrientation theOr = currentDevice.orientation;

    if ( UIDeviceOrientationIsLandscape(theOr) && !isLandVisible )
    {
        NSLog(@"setLand");
        isLandVisible = YES;
        isPortVisible = NO;

        [self.window.rootViewController pushViewController:portCont animated:YES];   // <Thread 1: breakpoint 2.1

    }

    if( UIDeviceOrientationIsPortrait(theOr) && !isPortVisible )
    {
        NSLog(@"setPort");
        isPortVisible = YES;
        isLandVisible = NO;

        [self.window.rootViewController pushViewController:portCont animated:YES];

    }
    [currentDevice beginGeneratingDeviceOrientationNotifications];

}

我正在努力支持加载时的两个方向,使用情节提要应用程序,并且在查看视图后不关闭视图(防止重新加载 UIWebViews 所必需的)。所以有两个问题超出了我的范围。谢谢。

4

1 回答 1

0

The Advanced App Tricks section of the iOS App Programming Guide has some guidelines about Launching in Landscape Mode, it could be that your answer lies within those few lines (if at all possible). Especially take care of the UIInterfaceOrientation in your Info.plist file.

于 2012-10-08T06:51:55.670 回答