Search code examples
iosios5ios6uiinterfaceorientation

Portrait mode only-iOS


I have an application and designed for only for portrait orientation. However I dont know how to restrict to use only portrait mode, once user upside down or landspace mode, I dont want my screen orinetation changes accordingly.

Any ideas how to do it?


Solution

  • That can be specified in the App Summary (and also in the rootviewcontroller (whether that be a Nav Controller, TabBar Controller, etc) by overriding this method:

    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
        return (interfaceOrientation == UIInterfaceOrientationPortrait);
    }
    

    enter image description here