> On Sep 29, 2013, at 5:01 PM, Paul Scott <psc...@skycoast.us> wrote:

> 
> So, I successfully update the image src attribute within the UIWebView page 
> using imageWithRederingMode:UIImageRederingModeAlwaysTemplate. However, the 
> image appears "unrendered" with the tint color. Why?

Because you misunderstand how template images work.

-imageWithRenderingMode just returns a shallow copy of your UIImage that 
returns the passed value when asked for its renderingMode. It does not create 
an image that draws itself in the tint color. How could it? The image has no 
idea what view's tint color to adopt at initialization or at drawing time.


> How do I get an image rendered in the tint color?

Start a bitmap context, set your template image as the image mask, set the full 
color to the appropriate tintColor, and fill the bounds of the context.

Construct a data URI out of the image you get by closing the bitmap context.

--Kyle Sluder

_______________________________________________

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