我正在启用UITextField的自动更正选项以显示建议文本。这里我的问题是要确定建议文本视图处于OPEN状态或CLOSE状态。
或
请任何人给我一个关于此的想法。
答案 0 :(得分:0)
我们可以使用键盘高度变化通知检测此更改,如下所示,
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(didReceiveKeyboardWillChangeFrameNotification:)
name:UIKeyboardWillChangeFrameNotification
object:nil];
- (void)didReceiveKeyboardWillChangeFrameNotification:(NSNotification *)notification
{
NSDictionary *userInfo = [notification userInfo];
CGRect keyboardEndFrame = [userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];
if (CGRectIsNull(keyboardEndFrame)) {
return;
}
UIViewAnimationCurve animationCurve = [userInfo[UIKeyboardAnimationCurveUserInfoKey] integerValue];
NSInteger animationCurveOption = (animationCurve << 16);
double animationDuration = [userInfo[UIKeyboardAnimationDurationUserInfoKey] doubleValue];
[UIView animateWithDuration:animationDuration
delay:0.0
options:animationCurveOption
animations:^{
}
completion:^(BOOL finished) {
}];
}