原文地址: http://blog.csdn.net/ginhoor/article/details/20454229
通過(guò)
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeLeft animated:YES];
方法的枚舉可以設(shè)置狀態(tài)欄方向夷蚊,但是需要在viewController中重寫
(BOOL)shouldAutorotate
{
return NO;
}
返回值為NO
如果此viewController在某個(gè)UINavigationController中需要在AppDelegate中寫個(gè)類目
@implementation UINavigationController (Rotation)(BOOL)shouldAutorotate
{
//在viewControllers中返回需要改變的viewController
return [[self.viewControllers firstObject] shouldAutorotate];
}
@end
如果此UINavigationController在某個(gè)UITabBarController中需要在AppDelegate中再寫個(gè)類目
@implementation UITabBarController (Rotation)
- (BOOL)shouldAutorotate
{
//在viewControllers中返回需要改變的NavigationController
return [[self.viewControllers firstObject] shouldAutorotate];
}
@end