0
votes

In iOS, after dismissing a modal view controller (which is being forced to only show in portrait orientation), if the device is being held in landscape mode, the view controller which presented the modal view controller doesn't rotate back to landscape correctly.

The 'willAnimateRotationToInterfaceOrientation' method gets called so I can manage rotation of my subviews etc. but then the actual view controller doesn't rotate to landscape. So my subviews look like they should in landscape, but the interface is in portrait mode.

The annoying thing is that it works fine in the iOS 5 simulator. Ie. After dismissing the modal view controller, the presenting view controller rotates back to landscape orientation.

Has anyone experienced something similar, or have any idea how to approach this?

1
In iOS 6 you have new methods to manage orientation shouldAutorotate, supportedInterfaceOrientations and preferredInterfaceOrientationForPresentationSergey Kuryanov

1 Answers

0
votes

For IOS 6 u need to handle the orientation with this methods.

- (BOOL)shouldAutorotate; {
    return YES;
}

- (NSUInteger)supportedInterfaceOrientations; {
    if([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone){
        return (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown);
    }
    else{
        return UIInterfaceOrientationMaskLandscape;
    }
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation; {
    if([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone){
        return UIInterfaceOrientationPortrait;
    }
    else{
        return UIInterfaceOrientationLandscapeLeft;
    }
}