1.先监控键盘出现的事件 :
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyBoardWillShow:) name:UIKeyboardWillShowNotification object:nil];
2.在监控触发的方法里获取键盘的高度:-(void)keyBoardWillShow:(NSNotification *)notification{
NSLog(@"notification is %@ ",notification);
NSDictionary *dic=[notification userInfo];
NSValue *value=[dic objectForKey:@"UIKeyboardFrameEndUserInfoKey"];
CGRect rect=[value CGRectValue];
UIView *view=[self viewWithTag:2002];
CGFloat keyBHeight=rect.size.height;
//根据键盘高度进行判断 做一些处理 比如是否遮盖输入框等问题 计算
}
}