iOS隐藏状态栏的方法
2017-07-18 本文已影响0人
专注_刻意练习
某个页面隐藏状态栏
方法一:
override var prefersStatusBarHidden: Bool{
return true
}
方法二:
/*添加隐藏状态栏,
在info.plist 中需要提前将View controller-based status bar appearance项设为NO
*/
UIApplication.shared.isStatusBarHidden = true
//修改状态栏颜色才会生效
UIApplication.sharedApplication.statusBarStyle = UIStatusBarStyleDefault;
如果要设置全局隐藏状态栏
方法一:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// 设置全局状态栏隐藏
application.isStatusBarHidden = true;
return true
}
方法二: