[英]How to show programmatically the NSTextView's Find Panel?
How to show programmatically with Swift 3 the NSTextView's Find Panel in macOS? 如何使用Swift 3以编程方式显示macOS中的NSTextView的查找面板?
The only info I found is to set and get its properties and some others but not how to show and hide it (for example): 我发现的唯一信息是设置和获取其属性以及其他一些属性,而不是如何显示和隐藏它(例如):
var usesFindBar: Bool A Boolean value that indicates whether to use the find bar for this text view. var UsesFindBar:Bool一个布尔值,指示是否对该文本视图使用查找栏。
https://developer.apple.com/reference/appkit/nstextview https://developer.apple.com/reference/appkit/nstextview
Use performFindPanelAction() , with .showFindInterface . 使用performFindPanelAction()和.showFindInterface 。 ( .showFindPanel works, too, but is deprecated.) ( .showFindPanel也可以,但是已弃用。)
Note that you can't pass the action directly. 请注意,您不能直接通过操作。 You'll need something with a var tag: Int
that can hold it: 您将需要带有var tag: Int
东西var tag: Int
可以容纳它的var tag: Int
:
button.tag = NSTextFinderAction.showFindInterface.rawValue
textview.performFindPanelAction(button)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.