在 Swift 中使用 Tab 键选择下一个 NSTextField [英] Select next NSTextField with Tab key in Swift

查看:56
本文介绍了在 Swift 中使用 Tab 键选择下一个 NSTextField的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在 Swift 中通过按键盘上的 Tab 键来更改响应者或选择另一个文本视图?

注意事项:它是用于填写空白类型的应用程序.

我的 VC 创建了一个单词列表 [Word],每个单词都有自己的 WordView - word.wordView.WordView 是显示的内容.WordView 是 NSTextView 的孩子.

我试图覆盖 keydown,但它不允许我在文本视图中输入任何内容.

解决方案

你必须连接你的 textField

Is there a way to change the responder or select another text view by pressing tab on the keyboard, in Swift?

Notes: It's for a fill in the blank type application.

My VC creates a list of Words [Word], and each of those words has its own WordView - word.wordView. The WordView is what is displayed. WordView is a child of NSTextView.

I tried to override keydown but it doesn't allow me to type anything in the text view.

解决方案

You have to connect your textField nextKeyView to the next textField through the IB or programmatically:

textField1.nextKeyView = textField2

这篇关于在 Swift 中使用 Tab 键选择下一个 NSTextField的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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