Stop images from loading in UIWebView

I have a website that I want to upload to UIWebView, but it is full of images and takes time to load. Images are useless and serve only to reduce usability on the iPhone. I do not own the site, so I can not change the actual site code.

The webpage is heavily connected to the Internet with ASP.NET and AJAX (need external files), so I don't think it's possible to load an HTML string.

I want the images to not fully load. So how do I block them? Change the HTML code as loading it or block images in some way?

+3
source share
4 answers

3 .

  • HTML
  • HTML
  • html ://URL. , -
+2

UIWebView , ! :

, , NSURLRequest, UIWebView. , , NSURLCache, , :

NSURLCache, - (NSURLCacheResponse *) cachedResponseForRequest: (NSURLRequest *)

, - ( NSURLCachedResponse). , , , (, PNG 0,0).

nil, .

, UIWebView . . :

UIWebView ?


:/

UIWebView ( UIWebViewDelegate).

, UIWebView, delagate :

- (BOOL) webView: (UIWebView *) webView shouldStartLoadWithRequest: (NSURLRequest *) request navigationType: (UIWebViewNavigationType) navigationType

, , , . NO : UIWebView.

, .

+1

:

webView:shouldStartLoadWithRequest:navigationType: WebView NO .

0

: , webView.

[- stopLoading];

0

Source: https://habr.com/ru/post/1740289/


All Articles