IPhone SDK: orientation lock

I saw this in a previous application (forgetting the name of the application), where you could lock the current screen orientation.

Is there an easy way to do this, for example, simply using a button.

+3
source share
1 answer

Just add ivar to the application delegate, which can be installed by pressing the lock button. Then, in all controllers of your kind, you can simply check ivar in the application deletion and answer

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation

according to your ivar orientation

+5
source

Source: https://habr.com/ru/post/1704031/


All Articles