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



是否可以仅对带有小屏幕的iPhone隐藏我的应用程序状态栏?谢谢

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
}

然后转到您的信息。请添加一个新值: View controller-based status bar appearance将值设置为NO。现在,状态栏将被隐藏针对iPhone 5、5s和SE。

最新更新