IOS UIWebView (Browser Control)

Source: Internet
Author: User

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)

Related Article

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.