今天发现iPhone Xr、iPhone 11在 iOS14 上通过下面的方法获取到状态栏的高度
UIApplication.shared.statusBarFrame.height
获取到的高度是48而不是44。
在程序里我们判断手机是不是全面屏,是通过下面的方法
let isEntirelyScreen = UIApplication.shared.statusBarFrame.height > 20 ? true : false
此时我们需要修改获取状态栏高度的方位为
let statusBarHeight = isEntirelyScreen ? 44 : 20
感觉这应该是系统的Bug?