Iphone Development - UITextField - Display (X) on the right

Possible Duplicate:
Adding a Clear Button to iPhone UITextField

Hey, I created a UITextField, and I want to add a (X) -CLEAR- button to the right of it. A regular button that clears what is already written in the text box. Thank.

+3
source share
2 answers

set clearButtonMode

field.clearButtonMode = UITextFieldViewModeAlways;
field.clearButtonMode = UITextFieldViewModeNever;
field.clearButtonMode = UITextFieldViewModeUnlessEditing;
field.clearButtonMode = UITextFieldViewModeWhileEditing;

or use Interface Builder, it also has a setting for the clear button.

+5
source

Set the text box clearButtonMode. See here .

0
source

All Articles