I have a webview to show web content, let said google.com. I use
NSURLRequest *request = [NSURLRequest requestWithURL:url
cachePolicy:NSURLRequestReturnCacheDataElseLoad timeoutInterval:30];
[storeWebView loadRequest:request];
on the viewDidLoad function. BUT when I click another button, which is in the web page (not the UIButton), how to I ‘save’ the cache and when I click another button, or back button, it will find and retrieve the cache?
My understanding is the system will cache the page for you, and if you use same request again, it will first look in the system cache, and if the page is there it will load it up from cache…
to clear cache, use
[[NSURLCache sharedURLCache] removeAllCachedResponses];if you want more control, take a look at NSURLCache Class Reference