键盘自动校正高度(有/无自动校正)

我得到这样的键盘高度:

- (void)keyboardNotification:(NSNotification*)notification { NSDictionary* keyboardInfo = [notification userInfo]; NSValue* keyboardFrameBegin = [keyboardInfo valueForKey:UIKeyboardFrameEndUserInfoKey]; CGRect keyboardFrameBeginRect = [keyboardFrameBegin CGRectValue]; } 

现在,我有键盘高度。 但没有自动更正高度:

在此处输入图像描述

如果UITextAutocorrectionTypeYES / NO则键盘高度保持不变。

如何获得键盘自动校正高度?

提前致谢。

用这个 :

  CGRect keyboardBounds; [[notification.userInfo valueForKey:UIKeyboardFrameEndUserInfoKey] getValue: &keyboardBounds]; // Need to translate the bounds to account for rotation. keyboardBounds = [self.view convertRect:keyboardBounds toView:nil]; 

使用UIKeyboardWillChangeFrameNotification 。 每当建议栏显示或隐藏时,都会调用此选项。

 NSConcreteNotification 0xc472900 {name = UIKeyboardWillChangeFrameNotification; userInfo = { UIKeyboardAnimationCurveUserInfoKey = 7; UIKeyboardAnimationDurationUserInfoKey = "0.25"; UIKeyboardBoundsUserInfoKey = "NSRect: {{0, 0}, {320, 216}}"; UIKeyboardCenterBeginUserInfoKey = "NSPoint: {160, 588}"; UIKeyboardCenterEndUserInfoKey = "NSPoint: {160, 372}"; UIKeyboardFrameBeginUserInfoKey = "NSRect: {{0, 480}, {320, 216}}"; UIKeyboardFrameChangedByUserInteraction = 0; UIKeyboardFrameEndUserInfoKey = "NSRect: {{0, 264}, {320, 216}}"; }}