YosiFZ
YosiFZ

Reputation: 7900

UINavigationController Orientation

I have UINavigationController with couple of view controller. this is the list of them: Main -> Album -> image

Now in the first and the second(Main and album) i want that the UINavigationController will not rotate(only portrait), and in the third one(Image) it will be possible to rotate.

i made already category for the UINavigationController:

-(BOOL)shouldAutorotate {
    if ([self.topViewController isKindOfClass:[MWPhotoBrowser class]]) {
        return YES;
    }
    return NO;
}

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
    if ([self.topViewController isKindOfClass:[MWPhotoBrowser class]]) {
        return YES;
    }
    return NO;
}

- (NSUInteger)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskAll;
}

Now my problem is that when i push the image viewcontroller and the rotate the device (the viewcontroller rotate) and press back and here(Album) the viewcontroller is rotate to and can't rotate back to portrait.

By the way: i noticed it happen only in device with iOS 6 and iPhone 5

Upvotes: 0

Views: 281

Answers (1)

CainaSouza
CainaSouza

Reputation: 1437

Have you tried including the method below but returning the correct value for your view controller?

- (NSUInteger)supportedInterfaceOrientations {

return UIInterfaceOrientationMaskPortraitUpsideDown;

}

Upvotes: 1

Related Questions