iOS WKWebView属性

释放双眼,带上耳机,听听看~!

1、WKWebView代理方法

// 页面开始加载时调用
- (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation;
// 当内容开始返回时调用
- (void)webView:(WKWebView *)webView didCommitNavigation:(WKNavigation *)navigation;
// 页面加载完成之后调用
- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation;
// 页面加载失败时调用 当开始加载数据时发生错误时调用。
- (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation withError:(NSError *)error;
// 在提交导航期间发生错误时调用。
- (void)webView:(WKWebView *)webView didFailNavigation:(WKNavigation *)navigation withError:(NSError *)error;

2、WKWebView 拨打电话

- (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation {
NSString *path = [webView.URL absoluteString];
NSString *newPath = [path lowercaseString];
// 拨打电话
if ([newPath hasPrefix:@"sms:"] || [newPath hasPrefix:@"tel:"]) {
UIApplication * app = [UIApplication sharedApplication];
if ([app canOpenURL:[NSURL URLWithString:newPath]]) {
[app openURL:[NSURL URLWithString:newPath]];
}
return;
}
}

人已赞赏
iOS文章

Failed to load Info.plist from bundle at path XXX

2019-12-31 15:02:32

iOS文章

iOS AFNetworking HTTPS客户端与服务端双向认证2.6/3.0

2019-12-31 15:55:49

个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
有新消息 消息中心
搜索