What is UIWebView
UIWebView is an iOS built-in browser control
The system comes with a Safari browser that is implemented through UIWebView
UIWebView not only can load remote Web resources, but also can load most of the common files
Html\htm
PDF, doc, ppt, txt
mp4
... ...
UIWebView Common ways to load resources
-(void) Loadrequest: (nsurlrequest *) request;
Common Properties and methods
Reload (refresh)- (void) reload; stop loading- (void) stoploading; fallback- (void) GoBack; move forward.- (void) GoForward; The data type that needs to bedetected @ property (nonatomic) uidatadetectortypes Datadetectortypes can be returned @ property(nonatomic,ReadOnly, getter=cangoback) BOOL CanGoBack; can advance @ Property(nonatomic,ReadOnly, getter=CanGoForward) BOOL CanGoForward; is loading in @ property(nonatomic,ReadOnly, getter=isloading) bool loading; Whether the content is scaled to fit the screenCurrent Size @ property (nonatomic) bool scalespagetofit;
becomes uiwebview The proxy for the , which adheres to the uiwebviewdelegate protocol, can listen to this method when the loading process of UIWebView starts sending a request (loading data) -(void ) Webviewdidstartload: (uiwebview *) WebView; Call this method when the request is complete (loading data) -(void ) Webviewdidfinishload: (uiwebview *) WebView; Call this method when the error is requested -(void ) WebView: ( UIWebView *) WebView didfailloadwitherror: (nserror *) error;
UIWebView calls this method before sending a request, and if NOis returned, represents the stop load request and returns YES, which represents the Allow load request -(BOOL) WebView: ( UIWebView *) WebView shouldstartloadwithrequest: (nsurlrequest
Navigationtype: (uiwebviewnavigationtype) Navigationtype;
What is JavaScript
JavaScript is a scripting language, short JS
JS's common role is
Add dynamic functionality to HTML pages, such as responding to user actions
Manipulate HTML elements, such as adding, deleting, and modifying page elements
Common JavaScript functions
Alert (10); Bullet Box
document.getElementById (' Test '); Get a DOM element based on ID
Call Javascipt in OC
How to invoke JavaScript code in OC
You can use the stringbyevaluatingjavascriptfromstring method of UIWebView
IOS UIWebView (Browser Control)