Space under status bar(dynamic island) in iPhone 14 Pros

Hi,

There is this extra space/gap between the status bar and the safe area(under dynamic island) in iPhone 14 Pro and Pro max. Which seems to be an OS issue. Yet if anyone has any fix for this please do help.

Answered by AgpaytechTeam_iOS in 729220022

Hi,

For this, I got a permanent solution. Please check this out

Code:

if #available(iOS 13.0, *) {

        let window = UIApplication.shared.windows.first

        let topPadding = window?.safeAreaInsets.top

        let statusBar = UIView(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.size.width, height: topPadding ?? 0.0))

        statusBar.backgroundColor = UIColor(named: "AppPrimaryColor")

        UIApplication.shared.windows.filter {$0.isKeyWindow}.first?.addSubview(statusBar)

}

Use this and thank me later.

The iPhone 14 Pro has a larger area at the top, above the Safe Area.
There's a nice explanation of it here:
https://useyourloaf.com/blog/iphone-14-screen-sizes/

If you look closely at UseYourLoaf's diagram for the iPhone 14 Pro Safe Area...
There's a 54-point height at the top, with an additional 5-point height below it.
Perhaps this is what you are running into?

Would you like to share your demo code, for further comment?

Accepted Answer

Hi,

For this, I got a permanent solution. Please check this out

Code:

if #available(iOS 13.0, *) {

        let window = UIApplication.shared.windows.first

        let topPadding = window?.safeAreaInsets.top

        let statusBar = UIView(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.size.width, height: topPadding ?? 0.0))

        statusBar.backgroundColor = UIColor(named: "AppPrimaryColor")

        UIApplication.shared.windows.filter {$0.isKeyWindow}.first?.addSubview(statusBar)

}

Use this and thank me later.

Space under status bar(dynamic island) in iPhone 14 Pros
 
 
Q