Reputation: 1390
I am developing an iOS application which makes heavy use of multiple UIWebViews. All the request's are loaded from local html files within the application bundle. I found awesome tips for attempting the prevent memory leaks on deallocation here: http://www.codercowboy.com/code-uiwebview-memory-leak-prevention
What I am looking to do is create a Factory class which holds a pool of 3 UIWebView instances, and any time a UIWebView is requested, it should request an instance from this pool. So I will never be deallocating the WebViews unless I run into a memory warning where I may deallocate the WebViews if neccessary.
This is what I have thought of so far, and am looking for any extra tips or comments on my suggestions.
Appreciate any input here!
Thanks, Fergal.
Upvotes: 0
Views: 2958
Reputation: 562
Try using paginated web page and you can cache data for pages using NSURLProtocol.
It would load pages and cache onto disk so navigation backward would be from cache and only 1 page would be in memory which is being viewed.
That is best you can do with UIWebView OR you may go for MKWebView it can allow you additional features.
Upvotes: 0
Reputation: 105
Instead of reloading the content using loadHTMLFromString or loadRequest, continue to use stringByEvaluatingJavascriptFromString to set the innerHTML of a section with an specific ID with the content you want, all through javascript, which won't use a big amount of memory
Upvotes: 1