UITabBar not showing selected item images in ios 7

You need to use tabBarItem initWithTitle:image:selectedImage

[[UITabBarItem alloc] initWithTitle:@"title" image:image selectedImage:imageSel];

in conjunction with changing the UIImage rendering mode:


or (to apply parent views template tint mask, this option is default for Tab bar Items unless you opt out with the above rendering mode)


here is a code sample for one tab bar item :-

UIImage *musicImage = [UIImage imageNamed:@"music.png"];
UIImage *musicImageSel = [UIImage imageNamed:@"musicSel.png"];

musicImage = [musicImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
musicImageSel = [musicImageSel imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];

self.musicViewController.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"Music" image:musicImage selectedImage:musicImageSel];

Leave a Comment