使用“下一步”的最佳方式UITextField上的Return按钮版本移动到下一个UITextField [英] Best way to use "Next" version of Return button on UITextField to move to next UITextField

查看:87
本文介绍了使用“下一步”的最佳方式UITextField上的Return按钮版本移动到下一个UITextField的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用返回键的下一个值来获取下一步按钮代替完成按钮,但是(显然)按下它不会自动移动到我视图中的下一个UITextField。

I use the "Next" value for the "Return Key" to get the Next button in place of the Done button, but (obviously) pressing it doesn't automatically move to the next UITextField in my view.

这样做的正确方法是什么?在一个更大的主题上,有哪些提示可以在iPhone SDK中正确构建表单?

What's the right way to do this? On a larger topic, what are some tips for properly building forms in the iPhone SDK?

推荐答案

将某个对象设为第一个文本字段委托,并实现 - (BOOL)textFieldShouldReturn:(UITextField *)textField 方法;在其中,调用第二个文本字段的 -becomeFirstResponder 。从中返回 YES 将使文本字段执行返回按钮的默认行为 - 我认为通常会发送其操作消息。如果您没有添加任何内容作为该操作的目标,那么返回的内容并不重要。

Make some object the first text field's delegate, and implement the - (BOOL)textFieldShouldReturn:(UITextField *)textField method; in that, call the second text field's -becomeFirstResponder. Returning YES from that will make the text field perform its default behavior for the return button – I think that's generally sending its action message. If you don't have anything added as a target of that action, it doesn't really matter what you return.

这篇关于使用“下一步”的最佳方式UITextField上的Return按钮版本移动到下一个UITextField的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆