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

2017-11-18  本文已影响8人  凌云01

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]替换就可以了

上一篇下一篇

猜你喜欢

热点阅读