Reputation: 418
I would like to know how I could lock the orientation for my main View Controller but allow my users to rotate to landscape for all the View Controllers?
Thanks in Advance!
Upvotes: 3
Views: 2155
Reputation: 266
This may help you..
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
-(BOOL)shouldAutorotate{
return NO;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{
return UIInterfaceOrientationPortrait;
}
Upvotes: 0
Reputation: 17536
- (NSUInteger)supportedInterfaceOrientations {
UIInterfaceOrientationMaskPortrait
}
The default for iPad is
UIInterfaceOrientationMaskAll
while the iPhone default is
UIInterfaceOrientationMaskAllButUpsideDown
you shouldn't need to implement anything else on your other view controllers
Upvotes: 0
Reputation: 6918
For MainViewController:
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskPortrait;
}
Other ViewControllers
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape;
}
Upvotes: 3