项目中需要实现单个界面的横屏,通过tranform来旋转屏幕的时候,需要同时旋转一下状态栏。但是直接设置setStatusBarOrientation
这个是无效的。
- 必须保证- (BOOL)shouldAutorotate返回的是NO。
- 同时,如果是NavgationController的话,需要设置NavgationController的shouldAutorotate,否则也是无效的
- (BOOL)shouldAutorotate {
return [[self.viewControllers lastObject] shouldAutorotate];
}
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
return [[self.viewControllers lastObject] supportedInterfaceOrientations];
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
return [[self.viewControllers lastObject] preferredInterfaceOrientationForPresentation];
}
简单记录一下问题。具体可以参考http://blog.csdn.net/ginhoor/article/details/20454229