iOS UITabbar去除上面横线

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去除上面横线)