1.若整个程序没有NavigationController可以直接使用以下这两方法来控制
-(BOOL)shouldAutorotate;
-(NSUInteger)supportedInterfaceOrientations;
2.若整个程序有NavigationController,则应对Nav写个类别,然后再在单个Controller里控制
Nav类别的写法:
@implementation UINavigationController (Rotation_IOS6)
-(BOOL)shouldAutorotate
{
return [self.topViewController shouldAutorotate];
}
-(NSUInteger)supportedInterfaceOrientations
{
return [self.topViewController supportedInterfaceOrientations];
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return [self.topViewController preferredInterfaceOrientationForPresentation];
}
@end