iOS 16 status bar height is getting wrong on iPhone 14 series

I have tried this below solution to get status bar height on iPhone 14 series with iOS 16 but getting wrong size. In app scene delegate is not used.


func getStatusBarHeight() -> CGFloat { 
    var statusBarHeight: CGFloat = 0
    if #available(iOS 13.0, *) { 
        let window = UIApplication.shared.windows.filter {$0.isKeyWindow}.first 
        statusBarHeight = window?.windowScene?.statusBarManager?.statusBarFrame.height ?? 0 
    } else { 
        statusBarHeight = UIApplication.shared.statusBarFrame.height 
    } 
    return statusBarHeight 
}

iPhone 14

Posted on Sep 27, 2022 12:04 AM

Reply

Similar questions

1 reply

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

iOS 16 status bar height is getting wrong on iPhone 14 series

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.