my project have UITabbar, UınavigationBar and UIViewContoller.
-UITabbar
—UINavigationController
—UIViewController
Question: how can i do landscape disable just one viewController? i want to only portrait view but for just one view.
my project have UITabbar, UınavigationBar and UIViewContoller.
-UITabbar
—UINavigationController
—UIViewController
Question: how can i do landscape disable just one viewController? i want to only portrait view but for just one view.
disable autorotate on a single UIViewController in iOS6
Add this to your app delegate
- (NSUInteger) application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
if ([[window.rootViewController presentedViewController] isKindOfClass:[YourViewController class]])
return UIInterfaceOrientationMaskPortrait;
else
return UIInterfaceOrientationMaskAllButUpsideDown;
}
EDIT 2
I recently found out about this, and it has been working perfectly for me. Add this code to your view controller
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskPortrait;
}
And in your viewWillAppear
add
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
///Disable orientation changes
NSNumber *value = [NSNumber numberWithInt:UIInterfaceOrientationPortrait];
[[UIDevice currentDevice] setValue:value forKey:@"orientation"];
}