my app contains two table view controllers. in the first one i want the view to be able to be rotated left and right (in addition to the portrait mode), however in the second table view controller ( which i navigate to after tapping a cell from the first table) i want it to only be viewed in portrait mode. i tried this code but it didn't work, it keeps on rotating.
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskPortrait;
}
- (BOOL) shouldAutorotate {
return NO;
}
note: i did actually enabled the left/right/portrait orientation from the Summary tab of the project target. any fix?
Create a category for UINavigationController which include the following methods:
(Works both for iOS 6 and iOS 5)
Then implement these methods in your controllers
First:
And Second:
The rotation settings of the project should look like:
Actually i found a solution for my problem:
this will restrict a view to portrait even if you toggled the left/right orientations in the Summary tab of the project's Traget.