> On Jan 11, 2016, at 17:24 , David Duncan <david.dun...@apple.com> wrote:
> 
> 
>> On Jan 11, 2016, at 3:53 PM, Rick Mann <rm...@latencyzero.com> wrote:
>> 
>> 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?
> 
> UIBarButtonItem does not explicitly convert the image to a template for 
> rendering. You can do so by calling -imageWithRenderingMoe: on your source 
> image.

Except in this case the image is a) inside a UIButton, and b) comes from an 
asset catalog where it's set to be a template.


-- 
Rick Mann
rm...@latencyzero.com



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to