Confusion around tint color and UIImage rendering mode
Confusion around tint color and UIImage rendering mode
- Subject: Confusion around tint color and UIImage rendering mode
- From: Rick Mann <email@hidden>
- Date: Mon, 11 Jan 2016 15:53:01 -0800
I have a UIButton subclass that does a lot of complex state changing, either replacing its image or drawing progress into itself. The images look like typical iOS 7+ icons, little blue outlines of things.
This worked well in the regular view hierarchy, but now I need to add one to at UINavigationBar. I dropped it in and it made a UIBarButtonItem to contain it. Everything seems to work, but it draws blue. I realized this was because the image was blue.
But as I investigated, it seemed that the actual drawn color depends on the UIImage's rendering mode, which was Default. I would've expected it to draw it as a template while applying the tint color when the view appeared in a nav bar, but it was blue. I tried changing the tint color of both the UIBarButtonItem and the UIButton in IB to white, but it still came out blue.
So I changed the rendering mode in the Asset catalog for the image to Template. Now it draws correctly in the nav bar, but ALSO in the regular view hierarchy. That is, it's white in the nav bar (regardless of UIBarButtonItem or UIButton tint color), and blue in the regular view hierarchy.
So, I'm a little confused. Any ideas what's going on?
Thanks,
--
Rick Mann
email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden