美文网首页iOS技术收藏
iOS UITabbar去除上面横线

iOS UITabbar去除上面横线

作者: 辣椒小鱼 | 来源:发表于2020-05-22 15:00 被阅读0次
    if (@available(iOS 13.0, *)) {
            UITabBarAppearance *appearance = [[UITabBarAppearance alloc] init];
            appearance.shadowColor = [UIColor clearColor];
            appearance.backgroundColor = [UIColor whiteColor];
            [self.tabBar setStandardAppearance:appearance];
        }else{
            //去掉top线
            self.tabBar.shadowImage = [UIImage new];
            self.tabBar.backgroundImage = [UIImage new];
            self.tabBar.backgroundColor = [UIColor whiteColor];
        }
          
        [[UITabBar appearance] setTranslucent:NO];  // view是否会延伸到最底部
        [[UITabBarItem appearance] setTitlePositionAdjustment:UIOffsetMake(0, -3)]; //设置title位置
        
        self.tabBar.layer.shadowColor = [UIColor redColor].CGColor;
        self.tabBar.layer.shadowOffset = CGSizeMake(0, -2);
        self.tabBar.layer.shadowRadius = 3;
        self.tabBar.layer.shadowOpacity = 0.05;
    
    
        self.tabBar.tintColor = [UIColor redColor]; //设置点击颜色
        if ([self.tabBar respondsToSelector:@selector(setBarTintColor:)]) {
           self.tabBar.barTintColor = [UIColor whiteColor];
        }
    

    相关文章

      网友评论

        本文标题:iOS UITabbar去除上面横线

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