Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to force portrait orientation? [closed]

How to force portrait orientation in iOS 7 if my application is initially supported for both orientations?

like image 347
user3664548 Avatar asked May 22 '14 10:05

user3664548


2 Answers

For the entire app, open the project file, go to the General tab, change the settings:

enter image description here

Or directly on the Info.plist file:

enter image description here

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.

like image 115
rtiago42 Avatar answered Oct 11 '22 11:10

rtiago42


UIViewController *c = [[UIViewController alloc]init];
[self presentViewController:c animated:NO completion:nil];
[self dismissViewControllerAnimated:NO completion:nil];
like image 28
Tariq Avatar answered Oct 11 '22 10:10

Tariq