如何使用 Swift 3 以编程方式在 macOS 中显示 NSTextView 的查找面板?
我找到的唯一信息是设置和获取它的属性以及其他一些但不是如何显示和隐藏它(例如):
var usesFindBar: Bool A Boolean value that indicates whether to use the find bar for this text view.
最佳答案
使用 performFindPanelAction() 和 .showFindInterface 。 ( .showFindPanel 也可以工作,但已弃用。)
请注意,您不能直接传递操作。你需要一些带有 var tag: Int
的东西来容纳它:
button.tag = NSTextFinderAction.showFindInterface.rawValue
textview.performFindPanelAction(button)
关于swift - 如何以编程方式显示 NSTextView 的查找面板?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41988733/