Basic Introduction to iOS essay-uiwebview-Official document translation

Source: Internet
Author: User

Inheritance Relationship: Nsobject-uiresponder-uiview-uiwebview

Follow: nscoding nsobject uiappearance uiappearancecontainer uicoordinatespace uidynamicitem UIScrollViewDelegate Uitraitenvironment

You can use the UIWebView class to embed Web content in your application. To do this, you simply create a UIWebView object, attach it to a window, and send a request to load the Web page content. You can also use this class to move back and page history forward, and you can even programmatically set the nature of some Web content.

Note:

In iOS 8 and later, it is recommended that you use Wkwebview instead of UIWebView. Also, if you use a JavaScript file that cannot be run, you should set the Wkpreferences property javascriptenabled to No.

Use Loadhtmlstring:baseurl: Start loading the local HTML file, Loadrequest method: The method to start loading Web content. Using the Stoploading method to stop loading, the loading property is to discover whether there is a Web view that is in the process of loading.

If you allow users to move backwards through the page history, you can use the GoForward and GoBack methods to do the button action. When you disable a button by using the CanGoBack and CanGoForward properties, the user cannot move in one direction.

By default, a webview automatically converts the phone numbers that appear in network content to phone numbers. When the phone link is clicked, the phone app dials. Set the Detectsphonenumbers property to No to turn off this default behavior.

When the page content is displayed, you can also use the Scalespagetofit property to set the scale of the page content. After that, the user can change the scale using gestures.

If you want to track Web content loading, set representative objects to conform to the Uiwebviewdelegate protocol.

Focus:

You should not embed UIWebView or UITableView objects into Uiscrollview objects. If you do this, unexpected behavior can cause the object of the touch event to be confusing and error-handling.

You can easily debug html,css and JavaScript, which contains the Web Inspector UIWebView. Read Debug Web content for iOS to learn how to configure iOS Web Inspector. Read the rest of the Safari Web content Guide in the home page to learn how to create Web content in the iphone and ipad Safari optimizer.

See the iOS Programming Guide for behavioral information about basic ideas.

Supported file formats

In addition to HTML content, UIWebView objects can be used to display other content types. For more information, see Using UIWebView to display select document types.

After iOS 6, if you assign a value to the Restorationidentifier property, it tries to keep its URL history, and the scrolling position of each page is scaled, and the information page is currently being viewed. During the recovery process, the view restores these values so that the network content is displayed. For more information on how to protect and restore work status, see the iOS App Programming Guide app programming guides for iOS.

For more information about appearance and behavior configuration, see Network View.

Inherited notes

UIWebView class cannot be inherited

Set Proxy: Delegate property

Loading content:

-LoadData:MIMETyoe:textEncodingName:baseURL:

-Loadhtmlstring:baseurl:

-Loadrequese:

Request

Loading

-stoploading

-reload

Move forward backwards

CanGoBack

CanGoForward

-goback

-goforward

Set Page content Properties

Scalespagetofit Property

ScrollView Property

Suppressesincrementalrendering Property

Keyboarddisplayrequiresuseraction Property

Running JavaScript

-stringbyevaluatingjavascriptfromstring

Delete data type

Datadetectortypes Property

Media playback

Gapbetweenpages Property

PageCount Property

Pagelength Property

Paginationbreakingmode Property

Paginationmode Property

Data type

Uiwebviewnavigationtype

Constant

Uiwebpaginationbreakingmode

Uiwebpaginationmode

Setting the Delegate
    • delegate Property
Loading Content
  • - loadData:MIMEType:textEncodingName:baseURL:
  • - loadHTMLString:baseURL:
  • - loadRequest:
  • request Property
  • loading Property
  • - stopLoading
  • - reload
Moving back and Forward
    • canGoBack Property
    • canGoForward Property
    • - goBack
    • - goForward
Setting Web Content Properties
  • detectsPhoneNumbers(IOS 3.0) Property
  • scalesPageToFit Property
  • scrollView Property
  • suppressesIncrementalRendering Property
  • keyboardDisplayRequiresUserAction Property
Running JavaScript
    • - stringByEvaluatingJavaScriptFromString:
Detecting Types of Data
    • dataDetectorTypes Property
Managing Media Playback
    • allowsInlineMediaPlayback Property
    • mediaPlaybackRequiresUserAction Property
    • mediaPlaybackAllowsAirPlay Property
Managing Pages
  • gapBetweenPages Property
  • pageCount Property
  • pageLength Property
  • paginationBreakingMode Property
  • paginationMode Property

Data Types
    • UIWebViewNavigationType
Constants
    • UIWebPaginationBreakingMode
    • UIWebPaginationMode

Basic Introduction to iOS essay-uiwebview-Official document translation

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.