AppleWebView - UBogun/Xojo-iosLib GitHub Wiki
Inherits from AppleView
Memory leak check: untested.
Status: complete
This is an implementation of UIWebView, the iOS class Xojo uses for a HTMLViewer. This class brings missing features from Desktop to iOS and even adds some more. For easy access, use the HTMLViewerExtension methods. Necessary notifications can be registered via a AppleNotificationCenter.
Xojo integration
In most cases, using the iOSHTMLViewerExtension will be sufficient for work with a Xojo HTMLViewer. A full featured custom control is available as iOSLibHTMLViewer.
Constructors
Constructor (aFrame as foundationframework.NSRect): Creates a new AppleWebView with the specified dimensions.
Properties
AllowsInlineMediaPlayback As Boolean: If true and the HTML source owns a webkit-playinline attribute, contained videos are played inline.
AllowsLinkPreview As Boolean: Whether pressing on a link displays a preview of the destination for the link. Available since iOS 9.0 on 3D Touch devices.
AllowsPictureInPicturePlayback As Boolean: Whether Picture in Picture playback is allowed from this view. Available since iOS 9.0.
CanGoBack As Boolean (read-only): True if you can use the GoBack method.
CanGoForward As Boolean (read-only): True if you can use the GoForward method.
DataDetectors As AppleDataDetectorType: Allows you to toggle the internal HTML data detectors.
GapBetweenPages As Double: The gap in points between pages.
IsLoading As Boolean (read-only): True if the view is currently loading.
KeyboardDisplayRequiresUserAction As Boolean: if True, the user must tap into elements to conjure the keyboard. If False, setting the focus on them is enough.
MediaPlaybackAllowsAirPlay As Boolean: Whether AirPlay is allowed from this view.
MediaPlaybackRequiresUserAction As Boolean: If False, contained videos strt automatically. Default is True.
PageCount As Uinteger (read-only): The number of pages contained in the view.
PageLength As Double: The size of each page in points in flow direction of the view. See PaginationMode.
PaginationBreakingMode As UIWebViewPaginationMode: Determines how certain CSS properties regarding column and page breaking are honored.
UIWebPaginationBreakingMode
Value | Description |
---|---|
Page | Content respects CSS properties related to page-breaking. |
Column | Content respects CSS properties related to column-breaking. |
PaginationMode As UIWebPaginationMode: Determines how and if the web contents are broken into pages.
UIWebPaginationMode
Value | Description |
---|---|
Unpaginated | Content appears as one long scrolling view with no distinct pages. |
LeftToRight | Content is broken up into pages that flow from top to bottom. |
TopToBottom | Content is broken up into pages that flow from top to bottom. |
BottomToTop | Content is broken up into pages that flow from bootn to top. |
RightToLeft | Content is broken up into pages that flow from right to left. |
ScalesPageToFit As Boolean: If True, the website is scaled to fit the view and the user can zoom in and out.
ScrollView As AppleScrollView (read-only): Lets you access the underlying scrollview.
SuppressesIncrementalRendering As Boolean: If True, website content is not rendered while it is being loaded.
Methods
GoBack(): Siwthces to the URL visited before.
GoForward(): Switches to the site visited before if the user went back.
Reload(): Reloads the content.
RunJavaScript (AScript As Text) As Text: Runs a JavaScript and returns its result. JavaScript must be less than 10 MB.
StopLoading(): Stops the current load process.
Events
LoadFailed (Error As AppleError): Fires if loading content fails.
LoadFinished(): The control finished loading content.
LoadStarted(): The control started loading content.
SuppressLoad(Request As AppleURLRequest, NavigationType As UIWebViewNavigationType) As Boolean: Fires when a request is started. Return true if you want to suppress answering the request.
UIWebViewNavigationType
Value | Description |
---|---|
LinkClicked | User tapped a web link. |
FormSubmitted | User submitted a form. |
BackForward | User used navigation history button. |
Reload | User tapped the reload button. |
FormResubmitted | User resubmitted a form. |
Other | Some other type. |