Reputation: 1786
Is there a way to stop screen rotation on a specific view? I need to have rotation enabled on my main screen but then disabled once a game mode is chosen. Is this possible?
Upvotes: 0
Views: 44
Reputation: 8855
I suppose by "on a specific view" you mean "in a specific view controller"? If so, you can just override - [UIViewController supportedInterfaceOrientations]
in this one view controller to return only the orientations that you support on that screen:
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskPortrait;
}
Upvotes: 2
Reputation: 9346
Write this in your AppDelegate
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
if ([self.window.rootViewController.presentedViewController isKindOfClass: [MainScreen class]])
{
return UIInterfaceOrientationMaskAll;
}
else return UIInterfaceOrientationMaskPortrait;
}
Upvotes: 0