I'm having problems trying to block the orientations in some views, but the code is not working property.
I'm using this lines in every view:
- (BOOL)shouldAutorotate
{
return YES;
}
- (NSUInteger)supportedInterfaceOrientations
{
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
return UIInterfaceOrientationMaskPortrait;
} else {
return UIInterfaceOrientationMaskAll;
}
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationPortrait;
}
It almost work in the views that are using the UINavigationController, but in the ones that use the UITabBarController is where i'm having big problems, because it seams that the code is not been called.
Ok I solve it, you have to subclass UINavigationController and UITabBarController, so here is the code:
now you just have to create your TabBarController or your NavigationController using this classes where ever you need it i.e.
I hope this help you guys.