简体   繁体   English

如何以编程方式显示NSTextView的查找面板?

[英]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.

相关问题 如何使以编程方式添加的 NSTextView 处于活动状态? - How to make a NSTextView, that is added programmatically, active? 如何在 NSTextView 点击位置显示 cursor - MacOS - How to show cursor in NSTextView click location - MacOS NSTextView:以编程方式设置文本格式 - NSTextView: format text programmatically 如何使用显式 NSLayoutManager、NSTextStorage、NSTextContainer 以编程方式设置 NSTextView? - How to set up an NSTextView programmatically with explicit NSLayoutManager, NSTextStorage, NSTextContainer? 如何以编程方式将文本作为 NSTextView 中的超链接? 斯威夫特 4,Xcode 9.4 - How to make the text as a hyperlink in NSTextView programmatically? Swift 4, Xcode 9.4 在NSTextView中找到一个子字符串,然后滚动到该子字符串的位置 - Find a substring within a NSTextView and then scroll to the substring's location 如何在Swift中的NSTextView中找到文本插入点的位置? - How to find the text insertion point position in an NSTextView in Swift? 如何以编程方式在UINavigationController的leftbarbuttonitem中显示UISearchController并在搜索后将其隐藏? - How to Programmatically show UISearchController in UINavigationController's leftbarbuttonitem and hide it after search? 如何以编程方式找到 Swift 的版本? - How can I programmatically find Swift's version? 如何以编程方式显示UITableViewController - How to show UITableViewController programmatically
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM