UIWebView的常用方法
//webview导航栏类型
enum UIWebViewNavigationType : Int { case LinkClicked case FormSubmitted case BackForward case Reload case FormResubmitted case Other }
//webview 分页类型 enum UIWebPaginationMode : Int { case Unpaginated case LeftToRight case TopToBottom case BottomToTop case RightToLeft }
enum UIWebPaginationBreakingMode : Int { case Page case Column }
class UIWebView : UIView, NSCoding, UIScrollViewDelegate, NSObjectProtocol { unowned(unsafe) var delegate: UIWebViewDelegate? @availability(iOS, introduced=5.0) var scrollView: UIScrollView { get } func loadRequest(request: NSURLRequest) func loadHTMLString(string: String!, baseURL: NSURL!) func loadData(data: NSData!, MIMEType: String!, textEncodingName: String!, baseURL: NSURL!) var request: NSURLRequest? { get } //重载 func reload()
//停止加载 func stopLoading() //后退 func goBack()
//前进 func goForward() //能否后退 var canGoBack: Bool { get }
//能否前进 var canGoForward: Bool { get }
//是否在加载
var loading: Bool { get }
// 和js的交互
func stringByEvaluatingJavaScriptFromString(script: String) -> String? var scalesPageToFit: Bool
@availability(iOS, introduced=3.0)
var dataDetectorTypes: UIDataDetectorTypes
@availability(iOS, introduced=4.0)
var allowsInlineMediaPlayback: Bool // iPhone Safari defaults to NO. iPad Safari defaults to YES
@availability(iOS, introduced=4.0)
var mediaPlaybackRequiresUserAction: Bool // iPhone and iPad Safari both default to YES
@availability(iOS, introduced=5.0)
var mediaPlaybackAllowsAirPlay: Bool // iPhone and iPad Safari both default to YES
@availability(iOS, introduced=6.0)
var suppressesIncrementalRendering: Bool // iPhone and iPad Safari both default to NO
@availability(iOS, introduced=6.0)
var keyboardDisplayRequiresUserAction: Bool // default is YES
@availability(iOS, introduced=7.0)
var paginationMode: UIWebPaginationMode
@availability(iOS, introduced=7.0)
var paginationBreakingMode: UIWebPaginationBreakingMode
@availability(iOS, introduced=7.0)
var pageLength: CGFloat
@availability(iOS, introduced=7.0)
var gapBetweenPages: CGFloat
@availability(iOS, introduced=7.0)
var pageCount: Int { get }
protocol UIWebViewDelegate : NSObjectProtocol { optional func webView(webView: UIWebView, shouldStartLoadWithRequest request: NSURLRequest, navigationType: UIWebViewNavigationType) -> Bool optional func webViewDidStartLoad(webView: UIWebView) optional func webViewDidFinishLoad(webView: UIWebView) optional func webView(webView: UIWebView, didFailLoadWithError error: NSError) }
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。