//获取状态栏的高度
+(int)kStatusBarHeight{
CGFloat statusBarHeight = 0;
if(@available(iOS 13.0, *)){
UIWindow *window = UIApplication.sharedApplication.windows.firstObject;
CGFloat topPadding = window.safeAreaInsets.top;
if(topPadding >0){
statusBarHeight = topPadding;
}else{
statusBarHeight = 20;
}
} else {
statusBarHeight = UIApplication.sharedApplication.statusBarFrame.size.height;
}
return statusBarHeight + 44;
}
网友评论