2022-11-22 iOS16 全面屏Tabbar 重设高度

-(void)viewDidLayoutSubviews{

    [super viewDidLayoutSubviews];

    if(@available(iOS16.0, *)) {

        CGRect frame = self.tabBar.frame;

        frame.size.height=69;

        frame.origin.y = self.view.frame.size.height-69;

        self.tabBar.frame= frame;

    }

}


    if(@available(iOS15.0, *)) {

        CGFloat height =49;

        if(KScreenHeight>=812) {

            height=89;

        }

        UIView *backView = [[UIView alloc] initWithFrame:CGRectMake(0,0, KScreenWidth, height)];

        backView.backgroundColor = SetColor(UI_TabbarBgColor);

        [self.tabBarinsertSubview:backViewatIndex:0];

    }


    if(@available(iOS16.0, *)) {

        for(UITabBarItem *iteminself.tabBar.items) {

            [itemsetImageInsets:UIEdgeInsetsMake(-20,0,0,0)];

            [itemsetTitlePositionAdjustment:UIOffsetMake(0, -20)];

        }

    }

你可能感兴趣的:(2022-11-22 iOS16 全面屏Tabbar 重设高度)