Cocoa Touch - 键盘总是隐藏起来
当用户选择文本字段时,我试图移动我的视图,以便文本字段仍然可见,我已经实现了。我还使用控制事件来确保在启用按钮之前文本字段不为空。
使用
[longTextField addTarget:self action:@selector(updateAnswerButtonEnabled:) forControlEvents:UIControlEventEditingChanged];
- (void)textFieldDidBeginEditing:(UITextField *)textField {
和
- (void)textFieldDidEndEditing:(UITextField *)textField {
会使键盘在每次输入字符后隐藏自身。这是为什么?我应该如何解决它?
I am trying to move my view when the user selects a text field so that the text field is still visible, which I have achieved. I am also using a control event to ensure that the text field is not empty before enabling a button.
Using
[longTextField addTarget:self action:@selector(updateAnswerButtonEnabled:) forControlEvents:UIControlEventEditingChanged];
- (void)textFieldDidBeginEditing:(UITextField *)textField {
and
- (void)textFieldDidEndEditing:(UITextField *)textField {
causes the keyboard to hide itself after every character input. Why is this and how should I get around it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
经过实验,从 textFieldDidEndEditing 调用 updateAnswerButtonEnabled 方法可以获得所需的响应。但是,我很想知道是什么导致了我发布的第一个方法的奇怪行为。
Having experimented, calling the method updateAnswerButtonEnabled from textFieldDidEndEditing has the desired response. However, I am interested to know what causes the strange behaviour with the first method I posted.