I went through all the solutions but none are working. I am developing an app for iOS 6, ipad. I want the keyboard to go away when user touches outside (on scrollview)...
Give the following code in viewDidLoad
-(void) ViewDidLoad
{
UITapGestureRecognizer *tapScroll = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapped)];
tapScroll.cancelsTouchesInView = NO;
[scrollview addGestureRecognizer:tapScroll];
}
And define the function as follows
- (void) tapped
{
[self.view endEditing:YES];
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With