• 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: Transparent Image with Tint Color
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Transparent Image with Tint Color


  • Subject: Re: Transparent Image with Tint Color
  • From: Paul Scott <email@hidden>
  • Date: Sun, 29 Sep 2013 17:01:21 -0700

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? How do I get an image rendered in the tint color?

    UIImage *image = [controller.infoIcon.image imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
    NSString *data = [UIImagePNGRepresentation(image) base64EncodedStringWithOptions:nil];
    [webView stringByEvaluatingJavaScriptFromString:
        [NSString stringWithFormat:@"%@%@%@",
            @"( function() {"
            @"    var x = document.getElementById('infoIcon');"
            @"    if ( !! x ) { "
            @"        x.src = 'data:image/png;base64,", data, @"';"
            @"    }"
            @"})();"
        ]
    ];

Paul

On Sep 29, 2013, at 3:10 PM, Paul Scott <email@hidden> wrote:

> I suppose I could try using stringByEvaluatingJavaScriptFromString: to insert the raw template-rendered image data into the web page with the Data URI scheme. The images are fairly small, so that seems doable, but if there's an easier way, I'd choose that path.
>
> Paul
>
> On Sep 29, 2013, at 2:55 PM, Paul Scott <email@hidden> wrote:
>
>> Now, I'm wondering if there's a way to get UIWebView to apply tint color to an image URL, via some extension?
>>
>> I would like my UIWebView-based app help — which references the app's images — to dynamically adopt the same tint color as the rest of the app, without resorting to saving the template-rendered image to disk.

_______________________________________________

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: Transparent Image with Tint Color
      • From: Kyle Sluder <email@hidden>
References: 
 >Re: Transparent Image with Tint Color (From: Paul Scott <email@hidden>)
 >Re: Transparent Image with Tint Color (From: Paul Scott <email@hidden>)
 >Re: Transparent Image with Tint Color (From: Paul Scott <email@hidden>)

  • Prev by Date: QLPreviewController - Implementation as in DocInteraction sample
  • Next by Date: Re: Transparent Image with Tint Color
  • Previous by thread: Re: Transparent Image with Tint Color
  • Next by thread: Re: Transparent Image with Tint Color
  • Index(es):
    • Date
    • Thread