设备 状态栏高度
iPhone XR/11 48
iPhone X/11 Pro/ 11 Pro Max/12 mini 44
iPhone 12/12 Pro/Pro Max 47
#define OStatusBarHeight ([NSObject statusBarHeight])
+ (CGFloat)statusBarHeight;
+ (CGFloat)statusBarHeight {
CGFloat statusBarHeight = 0;
if (@available(ios 13.0,*)) {
statusBarHeight = [UIApplication sharedApplication].windows.firstObject.windowScene.statusBarManager.statusBarFrame.size.height;
}else{
statusBarHeight = [UIApplication sharedApplication].statusBarFrame.size.height;
}
return statusBarHeight;
}
网友评论