0

I've created a tabBar in storyboard and set a custom image. I want to use a different image for the "selected" state, I know I can't set that image using storyboard but how do I do it programmatically?

I also want to change the icon tint colour in code but can't make that happen either.

I would significantly appreciate any help please.

JwL
  • 53
  • 2
  • 7

1 Answers1

0

Try this in you AppDelegate.m file

[tbc.tabBar setSelectionIndicatorImage:[UIImage imageNamed:@"YOUR_IMAGE_NAME.png"]];

where tbc - you TabBarController

UIStoryboard *iPhoneSB = [UIStoryboard storyboardWithName:@"Main_iPhone" bundle:nil];
    CustomTabBarController *tbc = [iPhoneSB instantiateInitialViewController];
Artem Z.
  • 1,243
  • 2
  • 14
  • 36