The keyboard hides when I click search or when I click on cancel. But I want also that the keyboard hides when I click somewhere on the screen. I found several tutorials for
Try to use this one
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { [self.view endEditing:YES]; }