How can I prevent the rotation on one UIViewController
by code ?
in more words I want to prevent rotation for one UIViewController
not for all
Asked
Active
Viewed 99 times
1

Mhmd Backer Shehadi
- 559
- 1
- 12
- 30
-
possible duplicate of [disable autorotate on a single UIViewController in iOS6](http://stackoverflow.com/questions/17370806/disable-autorotate-on-a-single-uiviewcontroller-in-ios6) – CRDave Apr 03 '14 at 07:45
2 Answers
1
You need to subclass the view controller, and then return NO from shouldAutoRotate
-(BOOL) shouldAutorotate {
return NO;
}

user3436048
- 11
- 1
1
In Your view controller
-(BOOL)shouldAutorotate {
return YES;
}
-(NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskPortrait;
}

Sai Pasumarthy
- 87
- 9