Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

wangyangcc/IMYWebView

Repository files navigation

IMYWebView

UIWebView seamless switching to WKWebView
无缝切换 UIWebView 为 WKWebView

##要求

  • ARC only

##使用方法

直接把你项目中的 'UIWebView' 名称替换为 'IMYWebView'

##在原框架基础上,添加了js回调oc的相关方法,用法如下

/**
 * iOS8下 本地注册js方法,让服务端调用
 */
- (void)addJsMethodIniOS8
{
 WYScriptMessageHandlerLeakAvoider *leakAvoider = [[WYScriptMessageHandlerLeakAvoider alloc] initWithDelegate:self];
 [_co_webView addScriptMessageHandler:leakAvoider name:@"closeMe"];
}

在当前类selfdealloc里面调用下面的方法:

/**
 * iOS8下 注销 本地注册的js方法
 */
- (void)removeJsMethodIniOS8
{
 [_co_webView removeScriptMessageHandlerForName:@"closeMe"];
}

About

UIWebView seamless switching to WKWebView

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Objective-C 100.0%

AltStyle によって変換されたページ (->オリジナル) /