iOS开发之TabBar背景色设置

// 第一种方式
[[UITabBar appearance] setBarTintColor:[UIColor blackColor]];
[UITabBar appearance].translucent = NO;

// 第二种方式
    UIView *view = [[UIView alloc]init];
    view.backgroundColor = [UIColor redColor];
    view.frame = self.tabBar.bounds;
    [[UITabBar appearance] insertSubview:view atIndex:0];
    
//还有第三种方法就是使用背景图片:
[[UITabBar appearance] setBackgroundImage:[UIImage imageNamed:@"tabBarBackgroundImage"]];
  [UITabBar appearance].translucent = NO;

猜你喜欢

转载自blog.csdn.net/weixin_34357962/article/details/87476511