本文介绍了键盘自动校正高度(有/无自动校正)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我得到这样的键盘高度:
I get the keyboard height like this:
- (void)keyboardNotification:(NSNotification*)notification
{
NSDictionary* keyboardInfo = [notification userInfo];
NSValue* keyboardFrameBegin = [keyboardInfo valueForKey:UIKeyboardFrameEndUserInfoKey];
CGRect keyboardFrameBeginRect = [keyboardFrameBegin CGRectValue];
}
现在,我有键盘的高度.但是没有自动校正高度:
Now, I have the keyboard height.But without the autocorrection height:
如果 UITextAutocorrectionType
为 YES
/ NO
,则键盘高度保持不变.
If the UITextAutocorrectionType
is YES
/ NO
the keyboard height stay the same.
如何获取键盘自动校正高度?
How can I get the Keyboard autocorrection height?
谢谢.
推荐答案
使用此方法:
CGRect keyboardBounds;
[[notification.userInfo valueForKey:UIKeyboardFrameEndUserInfoKey] getValue: &keyboardBounds];
// Need to translate the bounds to account for rotation.
keyboardBounds = [self.view convertRect:keyboardBounds toView:nil];
这篇关于键盘自动校正高度(有/无自动校正)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!