Today found iPhone Xr, iPhone 11 on iOS14 through the following method to obtain the height of the status bar
UIApplication.shared.statusBarFrame.height
Copy the code
I got 48 instead of 44.
In the program we determine whether the phone is full screen, is through the following method
let isEntirelyScreen = UIApplication.shared.statusBarFrame.height > 20 ? true : false
Copy the code
At this point, we need to modify the orientation of obtaining the height of the status bar as
let statusBarHeight = isEntirelyScreen ? 44:20Copy the code
Feels like it’s a Bug in the system?