jovany
jovany

Reputation:

caching the webcontent ( images ) on the iPhone

I have a question concerning the caching of webcontent.

I've created a UIWebview component

Code:

NSString *urlAddress = @"http://192.168.55.101/~test/mobile/iphone/ads/v0.1/";

        //URL OBJECT footer
        UIWebView *aWebView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320 , 100)];
        NSURL *url = [NSURL URLWithString:urlAddress];
        NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
        [aWebView loadRequest:requestObj];

This shows a picture in my iPhone. I've tried looking into cache attributes and functions (for instance NSURLRequestReturnCacheDataElseLoad ) to see which options I have , but what's the best way to cache the image appearing in this screen.

Or how do I use NSURLRequestReturnCacheDataElseLoad?

Upvotes: 0

Views: 744

Answers (1)

jantimon
jantimon

Reputation: 38140

There is a good sample code: Apple sample code

Description:

CacheInfo allows you to choose a URL, create a connection, load the resource asynchronously, and observe results such as the data size, load time, and cache usage. You can adjust the sizes of the shared memory and disk caches and observe how caching is affected during the load.

Upvotes: 2

Related Questions