Try this one:
[[self.searchField currentEditor] moveToEndOfLine:nil];
Pregunta
I can select all text in a NSSearchField by invoking its selectText: message (which is probably meant for the "Select All" menu item).
But how do I clear the selection, e.g. set the text cursor to the edit field's end, after I've set the text field with setStringValue:? (Note: setStringValue: selects the text automagically, which I don't want.)
I've tried invoking setSelectedRange: but that message is not understood by NSSearchField instances, it appears.
Solución
Try this one:
[[self.searchField currentEditor] moveToEndOfLine:nil];
Otros consejos
I should have just googled instead of asking here. The solution is hinted at on this site: http://rchampourlier.wordpress.com/2009/08/01/how-to-partially-select-content-of-a-nstextfield/
I need to get the "current editor", like this:
NSText *textEditor = [searchField currentEditor];
NSRange range = {start, length};
[textEditor setSelectedRange:range];