簡體   English   中英

如何以編程方式隱藏 NSTextView 的查找欄?

[英]How to programmatically hide the NSTextView's Find Bar?

當用戶在NSTextView控件中啟動查找操作時(例如,通過按鍵盤上的 ⌘ + F),當屬性usesFindBar設置為 true 時,查找欄變得可見。 那太棒了。

但是我如何以編程方式隱藏這個欄?

-(void)hideTextFinder{
 [txtFinder performAction:NSTextFinderActionHideFindInterface];
}

Based on @apodidae helpful answer, I was able to get a working solution after adding a NSTextFinder object to the view controller in the storyboard, and connecting the client outlet of this object to the NSTextView control and findBarContainer to the scrollview of the said text view .

然后將視圖 controller 中新創建的textFinder出口變量連接到 storyboard 中的文本查找器 object 后,@apodidae 的此代碼行(翻譯為:Swift)最終工作

textFinder.performAction(.hideFindInterface)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM