6

I want to show a clear button always in a UITextField. I have tried to both set this in .xib Interface Builder: enter image description here and in code using this line: [_firstNameField setClearButtonMode:UITextFieldViewModeAlways];

Neither causes the button to show. Help please.

carloabelli
  • 4,289
  • 3
  • 43
  • 70
  • Just as a side comment. It's UITextField that has the "clearButtonMode" property, not UITextView as you have it in your question. – LuisCien Aug 22 '13 at 00:07

1 Answers1

15

When you set it to UITextFieldViewModeAlways the clear button appears as long as there is text on the UITextField.

Hope this helps!

LuisCien
  • 6,362
  • 4
  • 34
  • 42