iOS 12 WKWebView 键盘bug处理
作者:
GTMYang | 来源:发表于
2018-12-20 17:05 被阅读0次
链接地址
/**
* observer notification when keyboard will hide
*/
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillHide)
name:UIKeyboardWillHideNotification
object:nil];
/////////////--------------------------//////////////
/*
*Description: this method was trigger by selector keyboarwillhide from notification
*/
-(void)keyboardWillHide
{
if (@available(iOS 12.0, *)) {
WKWebView *webview = (WKWebView*)self.webView;
for(UIView* v in webview.subviews){
if([v isKindOfClass:NSClassFromString(@"WKScrollView")]){
UIScrollView *scrollView = (UIScrollView*)v;
[scrollView setContentOffset:CGPointMake(0, 0)];
}
}
}
}
本文标题:iOS 12 WKWebView 键盘bug处理
本文链接:https://www.haomeiwen.com/subject/voxukqtx.html
网友评论