문제

After updating to iOS7, my app shows autorotation. I want it to be a landscape-only app and, accordingly, I set up everything as follows: In iOS6 was fine.

enter image description here

In .plist file:

enter image description here

In my MainWindow controller

-(BOOL)shouldAutorotate
{
    return NO;
}

-(NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskLandscape;
}

The AppDelegate.m call it as:

 MainViewController* mainViewController = [[MainViewController alloc] init];
    // Create the navigation controller
    UINavigationController *navController = [[UINavigationController alloc]
                                             initWithRootViewController:mainViewController];


    [navController setNavigationBarHidden:NO];
    [[self window] setRootViewController:navController];

But still the app autorotate in portrait mode when I rotate the device. In iOS 6 I had not such behavior.

도움이 되었습니까?

해결책

Try like this,

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return UIInterfaceOrientationLandscapeLeft;
}

- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskLandscape;
}
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
    return (UIInterfaceOrientationMaskLandscape);
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top