美文网首页
2022-11-22 iOS16 全面屏Tabbar 重设高度

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

作者: Bruin_熊先森 | 来源:发表于2022-11-21 10:09 被阅读0次

    -(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 重设高度

          本文链接:https://www.haomeiwen.com/subject/ffngxdtx.html