问题
My app displays a logfile in an NSTextView. I want the user to be able to search the output using the find bar, but not be able to replace any text. The NSTextView is set to be not editable, but when I press cmd-F, the find bar shows a "replace" checkbox:

I can prevent the user from being able to actually replace any text by implementing the NSTextViewDelegate protocol methods textView:shouldChangeTextInRange:replacementString: and
textView:shouldChangeTextInRanges:replacementStrings: but this does not remove or disable the checkbox. How can I do this?
回答1:
NSTextFinder won’t present the Replace box if its findBarContainer’s editable property is NO (false).
You can set the property in code (the API is in the rarely-used superclass, NSText) or uncheck the box in Interface Builder.
来源:https://stackoverflow.com/questions/23620390/how-do-i-disable-or-remove-the-replace-checkbox-of-nstextfinder