Advanced usage of WebView in iOS

Source: Internet
Author: User

Transferred from: http://www.cnblogs.com/gcb999/p/3178728.html

Framework: WebView and JS communication framework
#import "MJViewController.h" #import "Mbprogresshud+add.h" @interface Mjviewcontroller () @end @implementation        mjviewcontroller-(void) viewdidload{[Super Viewdidload]; [Self loadremotehtml];} #pragma mark loads the remote HTML page-(void) loadremotehtml {nsurl *url = [Nsurl urlwithstring:@ "Http://192.168.1.106:8080/MJServer        /"];    Self.webView.delegate = self; [Self.webview loadrequest:[nsurlrequest requestwithurl:url];} #pragma mark load other files-(void) Loadremotetxt {nsurl *url = [Nsurl urlwithstring:@ "http://192.168.1.106:8080/MJServer/abc.t        XT "];    Self.webView.delegate = self; [Self.webview loadrequest:[nsurlrequest requestwithurl:url];} #pragma mark load PDF file-(void) loadlocalpdf {//[self.webview loaddata:<# (NSData *) #> mimetype:<# (NSString *) #&gt ;        textencodingname:<# (NSString *) #> baseurl:<# (Nsurl *) #>];        Nsurl *url = [Nsurl fileurlwithpath:@ "/users/apple/desktop/10th-Network. pdf"];    Self.webView.delegate = self; [Self.webview Loadrequest:[nSurlrequest Requestwithurl:url]];}    #pragma mark Load HTML string-(void) loadhtmlstring {nsurl *url = [Nsurl fileurlwithpath:@ "/users/apple/pictures"]; [Self.webview loadhtmlstring:@ "

Usage of the service side

Advanced usage of WebView in iOS

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.