Search code examples
iphoneuistatusbariphone-x

On iPhone X, UIApplication.sharedApplication.statusBarFrame.size.height is 20


on iPhone X, UIApplication.sharedApplication.statusBarFrame.size.height is 20. As you know, on iphone X statusbar height is 44.

Because I set statusbar background using UIApplication.sharedApplication.statusBarFrame.size.height, there's weird blank white rectangle between statusbar and the contents. But if I set background height 44 manually, that white rectangle disappear.

I cannot understand why UIApplication.sharedApplication.statusBarFrame.size.height is 20 on iPhone X. Do I need to do something else to get statusbar height correctly on iPhone X?


Solution

  • I noticed this too while testing my app on iPhone X. In my case I resolved this issue (status bar height became 44) by using LaunchScreen.storyboard instead of Launch Images. But in general it can be caused by lacking of a launch image with appropriate size for iPhone X (1125px × 2436px), if there is no appropriate launch image, also black stripes may appear at top and bottom of the app.