It finally appeared.
First, install the NSTextFinder instances client in a class that implements the <NSTextFinderClient> protocol:
self.textFinder.client = self.textFinderController;
Then, make sure your NSTextFinder has findBarContainer set to the webView category described by Michael Robinson, or view the scroll in the WebView yourself:
self.textFinder.findBarContainer = [self.webView scrollView];
Set the position of the search bar above the content (or anywhere):
[self.webView scrollView].findBarPosition = NSScrollViewFindBarPositionAboveContent;
Finally, tell him to appear:
[self.textFinder performAction:NSTextFinderActionShowFindInterface]
It should appear in your web browser:
Also, not sure if this matters, but I have an NSTextFinder in XIB with the link:
@property (strong) IBOutlet NSTextFinder *textFinder;
You can also get it by simply executing it as usual: self.textFinder = [[NSTextFinder alloc] init];
Joel fischer
source share