开发者

Loading large web page in UIWebView

开发者 https://www.devze.com 2023-01-29 18:02 出处:网络
Whenever I load a large web page in a UIWebView in my app, it always crashes (low memory) after a few seconds before the page is fully loaded. The page is about 500k in size. the page loads fine in sa

Whenever I load a large web page in a UIWebView in my app, it always crashes (low memory) after a few seconds before the page is fully loaded. The page is about 500k in size. the page loads fine in safari, however i noticed that the entire page is not rendered initially. (showing a checkerboard background)

How can I do that so that UIWebView d开发者_如何学Pythonoesn't crash when loading a big file?


Well One simple approach that works in Optimizing UIWebView is pretty simple and I found it effective in one of my app. Creating new instances of UIWebView each time on user's action is not a feasible solution and most likely crashes the app after a few loads. Keep a Single Instance of UIWebView that you can work with throughout your app, so that you don't have to call ALLOC on UIWebView every time you want to load a web page. Just use the UIWebView's loadRequest: method to change the URL you want to point the user to. I hope this reduces you memory consumption.

0

精彩评论

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