选择按下选项卡时文本字段循环的顺序
我有几个文本字段,想设置一个特定的顺序,按下 Tab 键时它们将按该顺序循环。目前,它从带有 becomeFirstResponder
的文本字段开始,然后按照 xcode 放置的默认顺序继续。我可以以某种方式绕过该顺序并强制文本字段按特定顺序循环吗?就像将循环的最后一个链接回第一个循环一样。
感谢您的帮助。
I have several text fields and would like to set a particular order in which they would cycle when the tab key is pressed. Currently, it starts at a text field with becomeFirstResponder
and then goes on in the default order which xcode put. Can I somehow bypass that order and force the text fields to cycle in a particular order? Like linking the last one of the cycle back to the first one.
Thanks for the help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将窗口的
initialFirstResponder
出口连接到第一个文本字段,然后通过将该文本字段的nextKeyView
出口连接到下一个文本字段(以及很快)。Connect the
initialFirstResponder
outlet of your window to the first text field, then build a chain by connecting thenextKeyView
outlet of that text field to the text field that should come next (and so on).这就是所谓的 关键视图循环。
That's called the key view loop.