简体   繁体   中英

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;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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