• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Confusion around tint color and UIImage rendering mode
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Confusion around tint color and UIImage rendering mode


  • Subject: Re: Confusion around tint color and UIImage rendering mode
  • From: David Duncan <email@hidden>
  • Date: Mon, 11 Jan 2016 17:24:46 -0800

> On Jan 11, 2016, at 3:53 PM, Rick Mann <email@hidden> 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.

>
> 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

--
David Duncan


_______________________________________________

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


  • Follow-Ups:
    • Re: Confusion around tint color and UIImage rendering mode
      • From: Rick Mann <email@hidden>
References: 
 >Confusion around tint color and UIImage rendering mode (From: Rick Mann <email@hidden>)

  • Prev by Date: Re: Using CFHash to tell if a CFTypeRef has changed?
  • Next by Date: Re: Confusion around tint color and UIImage rendering mode
  • Previous by thread: Confusion around tint color and UIImage rendering mode
  • Next by thread: Re: Confusion around tint color and UIImage rendering mode
  • Index(es):
    • Date
    • Thread