由于iphone x 系统tabbar的高度在,- (void)viewDidLoad和-(void)viewWillAppear:(BOOL)animated时的高度是49,但是在-(void)viewDidAppear:(BOOL)animated执行是83所有,当我们的tabbar没有处理是可能漏出底部view上的东西;
例如:

我们可以在 -(void)viewDidAppear:(BOOL)animated 中进行重新设置,我的做法是家里白色背景,代码如下:-(void)setBackCor{
// 设置一个自定义 View,大小等于 tabBar 的大小
UIView *bgView = [[UIView alloc] initWithFrame:self.tabBar.bounds];
// 给自定义 View 设置颜色
bgView.backgroundColor = [UIColor whiteColor];
// 将自定义 View 添加到 tabBar 上
[self.tabBar insertSubview:bgView atIndex:0];
}
效果:

网友评论