I have app that supports all kind of orientations, however i want certain viewControllers to support only landscape and few to lock on Potrait Mode. How can i do that, I hav
All view controllers pushed on to the same navigation controller must support the same orientation. Specifically, I believe that only the root view controller shouldAutorotateToInterfaceOrientation
is ever taken into account. You can have a look at this S.O. post for a sort of workaround; or at this one for a different approach that could be of help.
The second post I linked above suggests using this definition for shouldAutorotateToInterfaceOrientation
you might tweak it for your case:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if ([self.selectedViewController isKindOfClass:[UINavigationController class]]) {
UIViewController *rootController = [((UINavigationController *)self.selectedViewController).viewControllers objectAtIndex:0];
return [rootController shouldAutorotateToInterfaceOrientation:interfaceOrientation];
}
return [self.selectedViewController shouldAutorotateToInterfaceOrientation:interfaceOrientation];
}