iOS屏幕顶部、底部的高度)

判断是否是iPad

#define ISIPAD [[UIDevice currentDevice] userInterfaceIdiom] ==UIUserInterfaceIdiomPad

判断手机型号为X

#define is_IPHONEX [[UIScreen mainScreen] bounds].size.width == 375.0f &&([[UIScreen mainScreen] bounds].size.height == 812.0f)

获取状态栏的高度 iPhone X - 44pt 其他20pt

#define StatusBarHeight [[UIApplication sharedApplication] statusBarFrame].size.height

获取导航栏的高度 - (不包含状态栏高度) 44pt

#define NavigationBarHeight self.navigationController.navigationBar.frame.size.height

屏幕底部 tabBar高度49pt + 安全视图高度34pt(iPhone X)

#define TabbarHeight self.tabBarController.tabBar.frame.size.height

屏幕顶部 导航栏高度(包含状态栏高度)

#define NavigationHeight (StatusBarHeight + NavigationBarHeight)

屏幕底部安全视图高度 - 适配iPhone X底部

#define TOOLH (is_IPHONEX ? 34 : 0)

屏幕底部 toolbar高度 + 安全视图高度34pt

#define ToolbarHeight self.navigationController.toolbar.frame.size.height

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。