0

Can anyone please let me know how to bring the clear option ('X' symbol) in the UITextField in objective c ? I have attached an image for your perusal. I want the 'x' symbol shown in the image to clear the text.enter image description here

Ashok Ambrose
  • 191
  • 3
  • 17

2 Answers2

5
 myUITextField.clearButtonMode = UITextFieldViewModeWhileEditing;
Shashank
  • 1,743
  • 1
  • 14
  • 20
2

If you are using Interface Builder, when you select the text field, in the atturbutes inspector (on the right), there should be an option for Clear Button. One of the options is "Appears While Editing," plus a few others.

In code, see the answer by @Shashank.

Mike D
  • 4,938
  • 6
  • 43
  • 99