A view that embeds web content in your app.
- iOS 2.0+
load method to begin loading local HTML files or the
load method to begin loading web content. Use the
stop method to stop loading, and the
is property to find out if a web view is in the process of loading.
If you allow the user to move back and forward through the webpage history, then you can use the
go methods as actions for buttons. Use the
can properties to disable the buttons when the user can’t move in a direction.
By default, a web view automatically converts telephone numbers that appear in web content to Phone links. When a Phone link is tapped, the Phone app launches and dials the number. To turn off this default behavior, set the
data property with a
UIData bitfield that does not contain the
You can also use the
scales property to programmatically set the scale of web content the first time it is displayed in a web view. Thereafter, the user can change the scale using gestures.
UIWeb with Web Inspector. Read Debugging Web Content on iOS to learn how to configure Web Inspector for iOS. Read the rest of Safari Web Content Guide to learn how to create web content that is optimized for Safari on iPhone and iPad.
For information about basic view behaviors, see View Programming Guide for iOS.
Supported File Formats
In addition to HTML content,
UIWeb objects can be used to display other content types, such as Keynote, PDF, and Pages documents. For the best rendering of plain and rich text in your app, however, you should use
In iOS 6 and later, if you assign a value to this view’s
restoration property, it attempts to preserve its URL history, the scaling and scrolling positions for each page, and information about which page is currently being viewed. During restoration, the view restores these values so that the web content appears just as it did before. For more information about how state preservation and restoration works, see App Programming Guide for iOS.
For more information about appearance and behavior configuration, see Web Views.
UIWeb class should not be subclassed.