iOS 关于调整状态栏方向方法setStatusBarOrientation的使用注意事项(转)

原文地址: http://blog.csdn.net/ginhoor/article/details/20454229

通过
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeLeft animated:YES];
方法的枚举可以设置状态栏方向,但是需要在viewController中重写

  • (BOOL)shouldAutorotate
    {
    return NO;
    }
    返回值为NO
    如果此viewController在某个UINavigationController中需要在AppDelegate中写个类目
    @implementation UINavigationController (Rotation)

  • (BOOL)shouldAutorotate
    {
    //在viewControllers中返回需要改变的viewController
    return [[self.viewControllers firstObject] shouldAutorotate];
    }

@end

如果此UINavigationController在某个UITabBarController中需要在AppDelegate中再写个类目
@implementation UITabBarController (Rotation)

  • (BOOL)shouldAutorotate
    {
    //在viewControllers中返回需要改变的NavigationController
    return [[self.viewControllers firstObject] shouldAutorotate];
    }

@end

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 1.监听屏幕旋转方向 在处理iOS横竖屏时,经常会和UIDeviceOrientation、UIInterface...
    彬至睢阳阅读 2,548评论 1 6
  • *7月8日上午 N:Block :跟一个函数块差不多,会对里面所有的内容的引用计数+1,想要解决就用__block...
    炙冰阅读 2,515评论 1 14
  • 转载:http://www.cnblogs.com/lear/p/5051818.html 1、屏蔽AppDele...
    动力机车阅读 641评论 0 0
  • 哦吼吼,又研究了几天,把FMDB这个封装好的数据库搞定了,写了个简单的例子,基于FMDB的添删改查操作,界面很一般...
    lichengjin阅读 545评论 0 0
  • 今天中午過去紫雲觀上香,祈求今年2017年可以闔家平安,財源廣進,家肥屋潤.給姊姊續點了文昌燈,給老公續點了財神燈...
    孩子們的痞子媽阅读 91评论 0 0