Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NSTextView yellow highlight like in safari search

I've done this before but I simply can't remember how I did it =(

So what I'm trying to do is to select a range in a NSTextView and make it visible with the yellow box similar to Safari search. As far as I remember there is a build in API for this but after searching like crazy I haven't found it. And I've asked about it once before on this site but apparently I can't find the old post...

The selectRange method does only select the range, it doesn't emphasize the selection at all.

Am I wrong about this meaning that there isn't an API for this already? If so what is the best approach. To add a CALayer to the textview and do it all by myself?

like image 696
Jakob Dam Jensen Avatar asked Jan 12 '10 14:01

Jakob Dam Jensen


1 Answers

Have you tried showFindIndicatorForRange:?

like image 56
Alex Avatar answered Sep 18 '22 16:09

Alex