-4

Is it possible to hide status bar of my app only for iPhones with small screens? Thanks

Dávid Pásztor
  • 51,403
  • 9
  • 85
  • 116
oce oci
  • 1
  • 1

1 Answers1

0

iPhone 5, 5S and SE have a screen width of 320. In your AppDelegate you could do the following:

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

And go to your info.plist and add a new value: View controller-based status bar appearance set the value to NO. The status bar will now be hidden for iPhone 5, 5S and SE.

Rashwan L
  • 38,237
  • 7
  • 103
  • 107
  • While a *valid* answer, two things: (1) You really shouldn't be looking a models - what if Apple comes up with an "iPhone SE version 2" with a 4.2 inch screen? At the very least, use *"<=" 320* not *"== 320"* (2) More so, does anyone else find it odd that the accepted answer of hiding a status bar - something that only increases available height - is code that checks for width? –  Sep 15 '17 at 18:20