iOS8 UIKeyboardWillShowNotification 键盘遮挡问题
2015-09-30 14:46
423 查看
iOS8中,键盘呼出会发送UIKeyboardWillShowNotification两次通知,导致在做键盘遮挡问题的时候会减两遍键盘的高度,原因如下:
The reason is the difference in the keyboard. If the second field is a password field this means there is another keyboard under the hood. Therefore the notification is sent twice.
解决方法:
@property(nonatomic, assign) BOOL kbIsOn;
/*
* 注册键盘的通知addObserver
*/
-(void)keyboardWillShow:(NSNotification *)noti
{
if(!_kbIsOn)
{
//遮挡操作
}
_kbIsON = YES;
}
-(void)keyboardWillHidden
{
_kbIsOn = NO;
//复原操作
}
The reason is the difference in the keyboard. If the second field is a password field this means there is another keyboard under the hood. Therefore the notification is sent twice.
解决方法:
@property(nonatomic, assign) BOOL kbIsOn;
/*
* 注册键盘的通知addObserver
*/
-(void)keyboardWillShow:(NSNotification *)noti
{
if(!_kbIsOn)
{
//遮挡操作
}
_kbIsON = YES;
}
-(void)keyboardWillHidden
{
_kbIsOn = NO;
//复原操作
}
相关文章推荐
- UITabBarController(菜单栏)带导航栏的tabBar
- iOS UI里面五大手势使用
- UIViewController生命周期
- IOS CAShapeLayer CAGradientLayer UIBezierPath 使用实例
- Reveal UI 分析工具简单使用
- iOS 8 UI布局 AutoLayout及SizeClass(二)
- UILocalNotification实现本地的闹钟提醒的方法
- easyui在datagrid中显示行详情(一)
- HTML标准中已经废弃的<marquee>标签
- UIImageView添加边框和阴影
- VMWARE player 如何让 win2012 guest os 支持HYPER-V
- 2015 ACM/ICPC Asia Regional Hefei Online J.Queue
- OpenCL C Built-IN Functions
- UGUI实现血条跟随
- GDB Guide
- “No 'Access-Control-Allow-Origin' header is present on the requested resource”
- Java StringBuilder 清空Clear方法
- Unique Binary Search Trees II
- NSTimer修改UIButton title时闪动问题
- E437: terminal capability "cm" required