iPhone UIWebView slow loading to local HTML files

前端 未结 7 1539
无人及你
无人及你 2021-02-01 03:47

I\'m developing an app that requires caching web pages (completely) along with their CSS files and images after saving the entire HTML of the page (going through the links to st

7条回答
  •  自闭症患者
    2021-02-01 04:21

    I can give you an idea about alternative ways of loading HTML from file into the UIWebView. A small project I've got uses Objective-C as a pure wrapper for UIWebView

    The project is here, but the main code is below: http://github.com/robb1e/iWeb

    - (void)viewDidLoad {
        NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"test" ofType:@"html" inDirectory:@"."]];
        NSURLRequest *request = [NSURLRequest requestWithURL:url];
        [webView loadRequest:request];
        [super viewDidLoad];
    }
    

    I'm also exploring ways of improving the perceived performance by showing an image while the DOM is getting ready. Some answers I've had are here:

    Displaying a background image on UIWebView

提交回复
热议问题