I am making an APP and would like the screen to always be in Portrait. I researched the internet, but I could not figure it out. I tried to use the UIInterfaceOrientation of the UIKit framework, but it did not work.
I am making an APP and would like the screen to always be in Portrait. I researched the internet, but I could not figure it out. I tried to use the UIInterfaceOrientation of the UIKit framework, but it did not work.
The easiest way to do it is through the project settings.
Select your main project (in the example case it is PMB), and after that choose the target you will make this change (probably only 1 option for you to select, unless you have created multiple targets).
Go to the General tab > Deployment info and leave only the orientation you want, in this case portrait .
I was able to find a way: D
Using UIKit.framework
File.h
-(NSUInteger) supportedInterfaceOrientations;
File.m
- (void)viewDidLoad {
[super viewDidLoad];
self.supportedInterfaceOrientations;
}
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskPortrait;
}