适配iPhone x 底栏高度(83:49)
#define TabbarHeight ([[UIApplication sharedApplication] statusBarFrame].size.height>20?83:49)
适配iPhone x 状态栏高度(44:20)
#define statusBarHeight [[UIApplication sharedApplication] statusBarFrame].size.height
适配iPhone x 顶栏高度(88:64)
#define navStatusHeight ([[UIApplication sharedApplication] statusBarFrame].size.height>20?88:64)
tableView适配
if (@available(iOS 11.0, *)) {
self.home_collectionView.contentInsetAdjustmentBehavior = UIApplicationBackgroundFetchIntervalNever;
} else {
self.automaticallyAdjustsScrollViewInsets = false;
// Fallback on earlier versions
}
宏定义形式
#define AdjustsScrollViewInsetNever(controller,view) if(@available(iOS 11.0, *)) {view.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;} else if([controller isKindOfClass:[UIViewController class]]) {controller.automaticallyAdjustsScrollViewInsets = false;}
网友评论