美文网首页
UIWebView的使用小结

UIWebView的使用小结

作者: 寒桥 | 来源:发表于2015-10-20 17:29 被阅读151次

    方法一:

    // 访问本地html

    NSString *htmlFile = [[NSBundle mainBundle] pathForResource:@"home_page" ofType:@"html"];

    NSString *htmlString = [NSString stringWithContentsOfFile:htmlFile encoding:NSUTF8StringEncoding error:nil];

    //    self.webView.scrollView.scrollEnabled = NO;

    [self.webView loadHTMLString:htmlString baseURL:[NSURL URLWithString:htmlFile]];

    方法二:

    // 访问本地html

    NSString *htmlFile = [[NSBundle mainBundle] pathForResource:@"home_page" ofType:@"html"];

    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:htmlFile]];

    [self.webView loadRequest:request];

    相关文章

      网友评论

          本文标题:UIWebView的使用小结

          本文链接:https://www.haomeiwen.com/subject/qtozcttx.html