Custom tab bar icon colors

后端 未结 7 1158
傲寒
傲寒 2020-12-08 12:39

Im currently using Xcode 5 to develop a list oriented app. I have a custom tint for the tab bar, custom images for the tab icons, custom tint for the tab bar\'s icon images

7条回答
  •  南方客
    南方客 (楼主)
    2020-12-08 12:50

    Try this way..it worked for me

    In app delegate

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
    
    
     UITabBarController *tabBarController=(UITabBarController*)(self.window.rootViewController);
        UITabBar *tabBar=tabBarController.tabBar;
      UITabBarItem *tabBarItem1=[[tabBar items] objectAtIndex:0];//first tab bar
     [tabBarItem1 setFinishedSelectedImage:[UIImage imageNamed:@"yourImageSelected.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"yourImageUnselected.png"]];//image should be 30 by 30
    }
    

    run and go

提交回复
热议问题