3
votes

I have a UINavigation base app in which I was supporting all orientations for some view controller but not for all using this code

@interface UINavigationController (Autorotation)

  • (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation; @end

    @implementation UINavigationController (Autorotation)

  • (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation{

if ([self.visibleViewController isKindOfClass:[MWPhotoBrowser class]] || [self.visibleViewController isKindOfClass:[ZoomPictureViewController class]]) { return YES; } return (toInterfaceOrientation == UIInterfaceOrientationPortrait); } @end

It was working great but not working in IOS6. I have set all four orientations supported in my projects plist file.

Help if anyone has found some work around for.

2

2 Answers

1
votes

In ios 6 there are new methods for orientation use these methods in your navigation controller subclass

-(BOOL) shouldAutorotate
{
return YES;
}

-(NSUInteger) supportedInterfaceOrientations{
if ([self.visibleViewController isKindOfClass:[YourClass class]] ||[self.visibleViewController isKindOfClass:[YourClass class]]) {
return UIInterfaceOrientationMaskAll;
}

return UIInterfaceOrientationMaskPortrait;
}