简体   繁体   English

如何更改UITabbarItem的文本颜色以及如何在iPhone应用程序中添加自定义TabBar?

[英]How to change the text color of a UITabbarItem and how to add a custom TabBar in an iPhone Application?

我想在iPhone应用程序中加载不同的自定义UITabBar以及如何将自定义彩色图像放到UITabBar

试试这个

if you like, you can change the background image of the tabbar. 如果您愿意,可以更改标签栏的背景图像。

Like this: 像这样:

- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController{
  NSUInteger index=[[tabBarController viewControllers] indexOfObject:viewController];
  switch (index) {
    case 0:{
        [_tabBar.tabBar setBackgroundImage:[UIImage imageNamed:@"Image1.png"]];
      break;
    }
    case 1:{
        [_tabBar.tabBar setBackgroundImage:[UIImage imageNamed:@"Image2.png"];
      break;
    }
    case 2:{
        [_tabBar.tabBar setBackgroundImage:[UIImage imageNamed:@"Image3.png"];
      break;
    }
    default:
      break;
  }
  return YES;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM