Instance Method

textFieldShouldBeginEditing:

Asks the delegate if editing should begin in the specified text field.

Declaration

- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField;

Parameters

textField

The text field in which editing is about to begin.

Return Value

YES if editing should begin or NO if it should not.

Discussion

The text field calls this method when the user performs an action that would normally initiate the editing of the text field’s text. Implement this method if you want to prevent editing from happening in some situations. For example, you could use this method to prevent the user from editing the text field’s contents more than once. Most of the time, you should return YES to allow editing to proceed.

If you do not implement this method, the text field acts as if this method had returned YES.

See Also

Managing Editing

- textFieldDidBeginEditing:

Tells the delegate that editing began in the specified text field.

- textFieldShouldEndEditing:

Asks the delegate if editing should stop in the specified text field.

- textFieldDidEndEditing:reason:

Tells the delegate that editing stopped for the specified text field.

- textFieldDidEndEditing:

Tells the delegate that editing stopped for the specified text field.

UITextFieldDidEndEditingReason

Constants indicating the reason why editing ended in a text field.