iOS 屏幕旋转之后状态栏隐藏问题

1、首先在Info.plist上添加

键值:View controller-based status bar appearance  参数为:NO

图一

2、在AppDelegate里面配置

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

   UIApplication.shared.setStatusBarHidden(true, with: .none)

  UIApplication.shared.setStatusBarHidden(false, with: .none)

}

UIApplication.shared.setStatusBarHidden(true, with: .none)  在Xcode 9上次方法废弃了用[UIViewController prefersStatusBarHidden]替换就可以了

你可能感兴趣的:(iOS 屏幕旋转之后状态栏隐藏问题)