How to prevent the screen from rotating?

Asked

Viewed 72 times

0

I’m making an APP and would like the screen to always be in Portrait. I looked it up online, but I couldn’t find out. I tried using the Uiinterfaceorientation framework Uikit, but it did not work.

2 answers

1


The easiest way to do it is through the design settings.

Select your main project (in the case of example is PMB), and after that choose the target that you will make this change (probably only have 1 option for you to select, unless you have created multiple targets).

Go on the tab General > Deployment info and leave only the guidance you want, in that case, Portrait.

selecione seu projeto selecione o target selecionar somente portrait

-1

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;
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.