动态获取键盘高度
当你需要根据键盘高度缩小视图的高度时,首先为监控键盘设置观察者 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardFrameChange:) name:UIKeyboardWillChangeFrameNotification object:nil];
然后设置函数
- (void)keyboardFrameChange:(NSNotification *) notif
{
NSDictionary *info = [notif userInfo];
NSValue *value = [info objectForKey:UIKeyboardFrameBeginUserInfoKey];//键盘frame的value值
//做你需要的处理CGSize keyboardSize = [value CGRectValue].size;
}

浙公网安备 33010602011771号