ios键盘遮挡问题
来源:互联网 发布:魔兽世界7.0多核优化 编辑:程序博客网 时间:2024/05/22 12:35
这个第三方可以看一下
IQKeyboardManager-(void)viewWillAppear:(BOOL)animated
{
[selfregisterForKeyboardNotifications];
}
-(void)viewWillDisappear:(BOOL)animated
{
[[NSNotificationCenterdefaultCenter] removeObserver:self];
}
- (void)registerForKeyboardNotifications
{
//使用NSNotificationCenter键盘出现
[[NSNotificationCenterdefaultCenter] addObserver:self
selector:@selector(keyboardWasShown:)
name:UIKeyboardDidShowNotificationobject:nil];
//使用NSNotificationCenter键盘隐藏
[[NSNotificationCenterdefaultCenter] addObserver:self
selector:@selector(keyboardWillBeHidden:)
name:UIKeyboardWillHideNotificationobject:nil];
}
- (void)keyboardWasShown:(NSNotification*)aNotification
{
if(![_tizitextisFirstResponder]){
NSDictionary* info = [aNotification userInfo];
//kbSize键盘尺寸 (有width, height)
CGSize kbSize = [[infoobjectForKey:UIKeyboardFrameEndUserInfoKey]CGRectValue].size;//键盘的高度
NSLog(@"hight_hitht:%f",kbSize.height);
NSLog(@"%@",NSStringFromCGRect(_publish.frame));
#warning 后期根据尺寸修改
[UIViewanimateWithDuration:0.1animations:^{
//最好用transform
self.view.frame =CGRectMake(0, -60,self.view.frame.size.width,self.view.frame.size.height);
}];}
}
//当键盘隐藏的时候
- (void)keyboardWillBeHidden:(NSNotification*)aNotification
{
//do something
[UIViewanimateWithDuration:0animations:^{
self.view.frame =CGRectMake(0,0, self.view.frame.size.width,self.view.frame.size.height);
}];
}
- iOS 键盘遮挡问题
- iOS 键盘遮挡问题
- ios键盘遮挡问题
- ios键盘遮挡UITextField问题
- iOS解决键盘遮挡问题
- iOS 解决键盘遮挡问题
- iOS解决键盘遮挡问题
- ios 处理键盘遮挡问题
- IOS开发 textField 键盘遮挡问题
- iOS解决键盘遮挡TextFiled的问题
- iOS 键盘遮挡问题(详细)
- iOS-键盘弹出遮挡问题
- iOS UITextField,UITextView键盘遮挡问题
- iOS开发 textField 键盘遮挡问题
- iOS键盘弹出遮挡输入框问题
- ios解决webview键盘遮挡问题
- iOS解决键盘遮挡输入框问题
- IOS 键盘遮挡处理
- [HDU1695]GCD(莫比乌斯反演)
- myeclise2015安装aptana步骤
- 数据库字段char varchar
- CXF跨域的两种方法
- Handler-Looper-Message源码分析
- ios键盘遮挡问题
- 数组与指针(基础&拓展)
- HTML5头部meta整理
- Jquery鼠标放上去显示全名
- Android Studio中断开SVN连接
- POJ 2486 树形背包
- MySQL数据库迁移(数据文件直接迁移)
- Android Studio常用插件—— JsonOnlineViewer
- ListView优化和图片闪烁探析