键盘弹出获取高度
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(KeyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
-(void)KeyboardWillShow:(NSNotification *)notification
{
NSDictionary *info = [notification userInfo];
//获取高度
NSValue *value = [info objectForKey:@"UIKeyboardBoundsUserInfoKey"];//关键的一句,网上关于获取键盘高度的解决办法,多到这句就over了。系统宏定义的UIKeyboardBoundsUserInfoKey等测试都不能获取正确的值。不知道为什么。。。
CGSize keyboardSize = [value CGRectValue].size;
float keyboardHeight = keyboardSize.height;
// 获取键盘弹出的时间
NSValue *animationDurationValue = [[notification userInfo] objectForKey:UIKeyboardAnimationDurationUserInfoKey];
NSTimeInterval animationDuration;
[animationDurationValue getValue:&animationDuration];
//自定义的frame大小的改变的语句
}