ios解决webview键盘遮挡问题
来源:互联网 发布:穿越火线游戏数据异常 编辑:程序博客网 时间:2024/06/06 00:16
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillShow:)
name:UIKeyboardWillShowNotification
object:nil];
//注册键盘隐藏通知
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillHide:)
name:UIKeyboardWillHideNotification
object:nil];
//键盘弹出后将视图向上移动
-(void)keyboardWillShow:(NSNotification *)note{
NSDictionary *info = [note userInfo];
CGSize keyboardSize = [[info objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue].size;
//目标视图view
CGRect frame = self.wkWebView.frame;
int y = frame.origin.y + frame.size.height - (self.view.frame.size.height - keyboardSize.height);
NSTimeInterval animationDuration = 0.30f;
[UIView beginAnimations:@"ResizeView" context:nil];
[UIView setAnimationDuration:animationDuration];
if(y > 0){
self.view.frame = CGRectMake(0, -y, self.view.frame.size.width, self.view.frame.size.height);
}
[UIView commitAnimations];
}
//键盘隐藏后将视图恢复到原始状态
-(void)keyboardWillHide:(NSNotification *)note{
NSTimeInterval animationDuration = 0.30f;
[UIView beginAnimations:@"ResizeView" context:nil];
[UIView setAnimationDuration:animationDuration];
self.view.frame =CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
[UIView commitAnimations];
}
- ios解决webview键盘遮挡问题
- iOS解决键盘遮挡问题
- iOS 解决键盘遮挡问题
- iOS解决键盘遮挡问题
- iOS解决键盘遮挡TextFiled的问题
- iOS解决键盘遮挡输入框问题
- iOS 键盘遮挡问题
- iOS 键盘遮挡问题
- ios键盘遮挡问题
- ios--解决键盘遮挡UITextField控件的问题(方式一)
- ios--解决键盘遮挡UITextField控件的问题(方式二)
- iOS 解决autolayout下键盘弹出遮挡问题
- iOS解决键盘遮挡输入框的问题
- 解决iOS键盘弹出遮挡输入框问题
- React Native 解决iOS上键盘遮挡TextInput问题
- iOS解决键盘弹出遮挡输入框问题
- React Native 解决 iOS 上键盘遮挡 TextInput 问题
- 解决键盘遮挡UITextField问题
- 表单总结(未完)
- JS视频和音频录制
- Duff in the Army codeforces 588E 树上主席树+lca
- Alien Security (搜索)
- C
- ios解决webview键盘遮挡问题
- C语言实现单链表
- Github上Pandas,Numpy和 Scipy三个库中20个最常用的函数
- linux初学者-延迟及定时任务篇
- MySQL调用存储过程显示非当前用户
- 会场安排问题
- 打印装袋标签
- u盘插入电脑被拒绝访问怎么解决
- mapreduce 报错