0

Here's my code:

UITapGestureRecognizer *gestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(resignTextView)];
    [self.tableview addGestureRecognizer:gestureRecognizer];


-(void)resignTextView
{
    [textView resignFirstResponder];
}

I added tableview with UITapGetureRecognizer. I do not know why it is not working?

Kanan Vora
  • 2,124
  • 1
  • 16
  • 26
user2003416
  • 159
  • 2
  • 9

1 Answers1

1

please add

 gestureRecognizer.numberOfTapsRequired = numberOfTapsRequired;

where numberOfTapsRequired is an int and than try. (be default it is 1, you can try it with 2 to check)

and since you are using UITableView I am not sure what type of hierarchy you are dealing with... you can have a look at this answer to understand how this works..

UITapGestureRecognizer breaks UITableView didSelectRowAtIndexPath

Community
  • 1
  • 1
Ankit Srivastava
  • 12,347
  • 11
  • 63
  • 115