美文网首页
获取WKwebview宽高

获取WKwebview宽高

作者: CYC666 | 来源:发表于2019-01-08 19:53 被阅读1次

- (void)webView:(WKWebView*)webView didFinishNavigation:(null_unspecifiedWKNavigation*)navigation;

该方法会在导航完成时回调,可用一下方法获取当前web的宽高

[webView evaluateJavaScript:@"getContentHeight();" completionHandler:^(id_Nullable response,NSError*_Nullable error)  {

                CGFloatheight = [response floatValue];

                    [weakSelf updateLayout];

        }];

注意:

使用wkwebview,需要导入<WebKit/WebKit.h>

相关文章

网友评论

      本文标题:获取WKwebview宽高

      本文链接:https://www.haomeiwen.com/subject/ywwbrqtx.html