I have added functionality when keyboard appears we will up cause keyboard hides most part of ipad, but when view is up no touch event works, main motive to dismiss keyboards when tap or touch outside below is screenshots shows I can't touch outside I have to use done button
Asked
Active
Viewed 107 times
-2
-
2you should consider editing your question and correcting sentence structure and punctuation! – MasterRazer Sep 06 '15 at 11:42
-
Please show your `textFieldDidBegin` delegate – Saheb Roy Sep 06 '15 at 12:01
-
@SahebRoy here `- (void)textFieldDidBeginEditing:(UITextField *)textField { if([tfUserName isFirstResponder] ){ userHover.hidden = false; } if([tfPassword isFirstResponder]){ pwdHover.hidden = false; } if([tfURL isFirstResponder]){ urlHover.hidden = false; [self animateTextView:YES]; } } ` – iDeepak Sep 07 '15 at 03:34
-
Possible duplicate of [Move UIView up when the keyboard appears in iOS](https://stackoverflow.com/questions/11282449/move-uiview-up-when-the-keyboard-appears-in-ios) – Cœur Nov 09 '18 at 05:17
1 Answers
3
You will need to create a UITapGestureRecognizer
!
First of all define a UITapGestureRecognizer
in your header (.h) file.
Then in the viewDidLoad
:
tapGesture =
[[UITapGestureRecognizer alloc] initWithTarget:self
action:@selector(closeKeyBoard)];
[self.view addGestureRecognizer:tapGesture];
Now the method which closes the keyboard:
-(void)closeKeyBoard {
[self.view endEditing:YES];
}
That's all you need!
Cheers

MasterRazer
- 1,377
- 3
- 16
- 40
-
-
-
Add [self.view setUserInteractionEnabled:YES]; to your viewDidLoad!! – MasterRazer Sep 06 '15 at 12:27