Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

2
  • Works great! If you need a tinted template image, then you can define the tintColor as clearButton.tintColor = yourTintColor and use an image template as described here: stackoverflow.com/a/54213781/826946 Commented May 24, 2020 at 19:35
  • Actually - this doesn't seem to behave exactly like the built-in cancel button, because it appears even when the textfield is empty (in editing mode, but empty). You need to also take care of setting textField.rightView?.isHidden appropriately to fully emulate standard behavior Commented May 24, 2020 at 19:46