|
|
@@ -18,8 +18,6 @@
|
|
|
@property(strong,nonatomic)UIProgressView *progress;
|
|
|
|
|
|
@property(strong,nonatomic)WKWebView *webView;
|
|
|
-@property(nonatomic,strong)JSContext *context;
|
|
|
-@property(nonatomic,strong)WKUserContentController *userContentController;
|
|
|
|
|
|
@end
|
|
|
|
|
|
@@ -49,7 +47,6 @@
|
|
|
|
|
|
//监听相应的事件
|
|
|
webConfig.userContentController = userContent;
|
|
|
- self.userContentController = userContent;
|
|
|
|
|
|
self.webView = [[WKWebView alloc]initWithFrame:CGRectMake(0, 64, self.view.frame.size.width, self.view.frame.size.height) configuration:webConfig];
|
|
|
|
|
|
@@ -186,9 +183,14 @@
|
|
|
|
|
|
}
|
|
|
|
|
|
--(void)dealloc{
|
|
|
+-(void)removeAllMsgHandler{
|
|
|
+
|
|
|
+ [self.webView.configuration.userContentController removeScriptMessageHandlerForName:@"event"];
|
|
|
+
|
|
|
|
|
|
- [self.userContentController removeScriptMessageHandlerForName:@"event"];
|
|
|
+}
|
|
|
+
|
|
|
+-(void)dealloc{
|
|
|
|
|
|
[self.webView removeObserver:self forKeyPath:@"estimatedProgress"];
|
|
|
|