仅在iPhone 5,5s,SE上隐藏状态栏

时间:2017-09-15 15:59:28

标签: iphone swift

是否可以仅为具有小屏幕的iPhone隐藏我的应用的状态栏?感谢

1 个答案:

答案 0 :(得分:0)

iPhone 5,5S和SE的屏幕宽度为320.在AppDelegate中,您可以执行以下操作:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    if UIScreen.main.bounds.width == 320 {
        application.isStatusBarHidden = true
    }
    return true
}

转到info.plist并添加新值: View controller-based status bar appearance将值设置为NO。现在,iPhone 5,5S和SE将隐藏状态栏。

相关问题