开发者

Image processing in iPhone - what is the best?

I want to write an iPhone app - view image app. And I have an example: Example (newspaper reader)

That example is a newspaper reader. But i like the开发者_如何学编程ir image processing. Their processing is:

  1. Load low quality image (small resolution) first.
  2. Continue load high quality image (high resolution) step by step. They divide image into 9 piece (A --> I). And then they load from A, B, C, ... to I. Done, we have a nice image.

    A B C

    D E F

    G H I

Here is the question :D:

- i want to know what is the technology they used in their application?

- What is the best method to processing image in objective - c (iphone :D)

Thanks verymuch for your help and sorry for my bad English.


One possibility is that wherever they have what you think is a custom UIImageView they actually have a UIWebView. The reason I say this is because when you load an image in a UIWebView it does this partial loading for you.

The way I would go about adding this is to have 2 images: a small load quality gif & a higher quality one you actually want to display. Now wherever you would use a custom UIImageView instead place a UIWebView.

Load the webView with a little html string like this.

NSString *htmlString = [NSString stringWithFormat:@"<img style=\"position:absolute; top:0px; left:0px; width: 100%; height: 100%;\" src=\"%@\"/>   <img style=\"position:absolute; top:0px; left:0px; width: 100%; height: 100%;\" src=\"%@\"/>", lowResURL, hiResURL];
    [webView loadHTMLString:htmlString baseURL:nil];
    webView.userInteractionEnabled = NO;

(Bring your own NSStrings called, lowResURL & hiResURL.)

Now it should load the first low resolution copy much quicker giving it a rough idea of what it'll look like while the other one loads on top of it showing the full image.

NOTE: This might not (and probably isn't) the way the app you pointed to does it but is the quickest/easiest way to achieve the effect you described.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜