You need to use tabBarItem initWithTitle:image:selectedImage
[[UITabBarItem alloc] initWithTitle:@"title" image:image selectedImage:imageSel];
in conjunction with changing the UIImage rendering mode:
imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal
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)
imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate
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];
Hope this helps
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…