Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Implementing Designs for iPhone Customizing Table View Controllers Styling the Tab Bar

Brian Rudolph
Brian Rudolph
9,340 Points

Ribbit - tabBar icon colors (method deprecated + issue)

First, I'd like to point out the method "setFinishedSelectedImage:(UIImage *) withFinishedUnselectedImage:(UIImage *)" has been deprecated in iOS 7. The code still works though.

My issue is when I try to change the color of the icons without images (first part of the video). No matter what color I choose for Tint, the icon selected keeps the default blue color.

1 Answer

Alejandra H Bernal
PLUS
Alejandra H Bernal
Courses Plus Student 4,667 Points

I figured it out this way:

UIImage *inboxImage = [UIImage imageNamed:@"inbox"];
inboxImage = [inboxImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
UITabBarItem *tabInbox = [tabBar.items objectAtIndex:0];
[tabInbox setImage:inboxImage];
[tabInbox setSelectedImage:inboxImage];

UIImageRenderingModeAlwaysOriginal keeps the original image and colours. I hope you might find this helpful!!:)