开发者

How to get image data from a WebView into an NSData object? [closed]

开发者 https://www.devze.com 2022-12-14 17:39 出处:网络
Closed. This question needs to be more focused. It is not currently accepting answers. 开发者_JAVA百科
Closed. This question needs to be more focused. It is not currently accepting answers. 开发者_JAVA百科

Want to improve this question? Update the question so it focuses on one problem only by editing this post.

Closed 4 years ago.

Improve this question

I have a Cocoa app that embeds a WebView. The WebView loads html elements including images. I have the textual links for the images (e.g. "http://www.domain.com/path/image.jpg"), but what I want is the image data itself so I can put it in an NSData object and ship it off to Growl. The WebView must have this data since it has downloaded and rendered the image. How can I get at it?


Try this:

  1. Get the web view's main frame.
  2. Get the frame's data source.
  3. Ask the data source for the downloaded resource for the image URL.
  4. Get the resource's data.
0

精彩评论

暂无评论...
验证码 换一张
取 消