Hello I have two UITextFields in my application, and want to dismiss the keyboard when I just touch anywhere except the UITextFields how can I do this?
Typically in this scenario you will have a scroll view holding the rest of the User Interface. If you assign the delegate of that scroll view to your view controller, and say that you implement the protocol UIScrollViewDelegate
, then just adding the following method will do the job:
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
{
[self.view endEditing:YES];
}