- Set UITextField delegate in the main storyboard
- implement the protocol UITextFieldDelegate or UITextViewDelegate in the view controller
- override the function
Dismiss Keyboard on Background Tapfunc textFieldShouldReturn(textField: UITextField) -> Bool
- Change the view class from UIView to UIControl
- Allow User Interaction should be checked
- Create an action touch down on the UIControl
- On the action for touch down, invoke:
@IBAction func backgroundTouchDown(sender: AnyObject) {view.endEditing(true)}