How to force portrait orientation in iOS 7
if my application is initially supported for both orientations?
For the entire app, open the project file, go to the General tab, change the settings:
Or directly on the Info.plist file:
If you only want it on a specific view controller, override supportedInterfaceOrientations
:
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskPortrait;
}
You can read more about the second method at the official UIViewController documentation. Maybe, you'll find a more suitable way for your specific problem.
UIViewController *c = [[UIViewController alloc]init];
[self presentViewController:c animated:NO completion:nil];
[self dismissViewControllerAnimated:NO completion:nil];
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