iphone - How to display this little white x-circle in a UITextField, so users can delete the text? -


In some apps it has a nice white circle in which Gray X has UITextField. How can I add it to a UITextField and delete the text when the text is removed? Like to add a button, you use the ClearButtonMode property of UITextField

can do.
Code will:

  // Never hit the Cancel button textField.clearButtonMode = UITextFieldViewModeNever; // When you are editing text in textField textField.clearButtonMode = UITextFieldViewModeWhileEditing, then only show the cancel button; // Show Cancel button only when you are not editing text text, file. ScaleButtonNode = UITextFieldViewModeUnlessEditing; // Always Cancel button textField.clearButtonMode = UITextFieldViewModeAlways;  

Comments