Dismiss TextView or TextField

1) When clicking ‘Done’

Put protocol UITextViewDelegate and/or UITextFieldDelegate in there…

set up the variable….make sure you add target for the method UIControlEventEditingDidEndOnExit:

Implement the method:

2) To dismiss Keyboard on tap of the View:

view controller’s header:

view controller’s viewDidLoad:

view controller:

Finally, follow this link http://rickytsao.com/?p=1299
in order to cancel keyboard by tapping anywhere outside of it.

Leave a Reply