解决iPhone 6 Plus横屏启动界面错乱的问题

项目要求适配iPhone6和iPhone 6 Plus,后期测试的时候发现了一个奇特的Bug。由于iPhone 6 Plus有独特的横屏模式,横屏模式启动应用会形成界面错乱,下半部分变成黑色:app

error
error

这样的状况有几个前提: 测试

  1. 应用单独导入了6 Plus的启动图片,也就是适配了iPhone 6 Plus。
  2. 应用支持横屏方向。
  3. 根视图为UITabBarController。
  4. 应用横屏状况下启动。

解决办法: ui

  1. AppDelegate中,在didFinishLaunchingWithOptions方法中建立window前先加入:
    application.statusBarOrientation = UIInterfaceOrientationPortrait;
  2. 在rootController,viewDidAppear方法中添加:(解决旋转界面错乱)
    [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait| UIInterfaceOrientationLandscapeLeft|UIInterfaceOrientationLandscapeRight];
相关文章
相关标签/搜索