{
NSInteger BatteryH;
NSInteger TabBarH;
}
viewDidLoad
[self panduan_iPhoneX];
#pragma mark - - 判断导航高度好tab的高度
- (void)panduan_iPhoneX {
// 状态栏(statusbar)
CGRect rectStatus = [[UIApplication sharedApplication] statusBarFrame];
//NSLog(@"status width - %f", rectStatus.size.width); // 宽度
//NSLog(@"status height - %f", rectStatus.size.height); // 高度
// 导航栏(navigationbar)
CGRect rectNav = self.navigationController.navigationBar.frame;
//NSLog(@"nav width - %f", rectNav.size.width); // 宽度
//NSLog(@"nav height - %f", rectNav.size.height); // 高度
if (rectStatus.size.height == 44) {
BatteryH = 24;
TabBarH = 83;
}else {
BatteryH = 0;
TabBarH = 49;
}
}
// tableView 偏移20/64适配
if (@available(iOS 11.0, *)) {
self.mainTableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;//UIScrollView也适用
}else {
self.automaticallyAdjustsScrollViewInsets = NO;
}
网友评论