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;

你可能感兴趣的:(iOS开发之TabBar背景色设置)