I am trying to force orientation on a view using this code.
-(BOOL)shouldAutorotate
{
return YES;
}
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationLandscapeLeft;
}
What happens is the view loads in the simulator in landscape and when I turn it to portrait the app crashes and I get this error 'Supported orientations has no common orientation with the application, and shouldAutorotate is returning YES'
. What I would like to happen is that when you turn it into portrait it remains in landscape and doesn't crash.
If you try to return NO in shouldAutorotate?
Have you tried
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape | UIInterfaceOrientationMaskPortrait;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With