Search code examples
ioscocoa-touchios6uiinterfaceorientationautorotate

Preventing auto rotation on every view controller of my application IOS 6


How do I go about disabling auto rotation on every view controller of my application? I want each view/screen to only be viewed in portrait mode, I do not want my view controllers to transition to landscape mode if the phone is rotated. How can I go about doing this? I have seen too many confusing explanations/tutorials on the web. I have tried the following code on a particular view controller and it did not help, the view still rotated

- (NSInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskPortrait;
}

- (BOOL) shouldAutorotate {
    return YES;
}

Solution

  • Just go to the summary of your application target and Check only the portrait mode.

    enter image description here