Forcing a Cocoa text field to end editing

Viewed 11981

I have a view based gui that contains a text field for each gui item. When I select another menu item I want my text fields to exit out of editing mode. I could not find anyway to do this in the nsTextField docs. Any ideas?

4 Answers

You need to tell the window to remove first responder status from the control:

[[textField window] makeFirstResponder:nil];

This will end editing and remove focus from the text field.

Related