Reputation: 403
I implemented
scrollViewWillBeginDragging:(UIScrollView *)scrollView{
[searchBar resignFirstResponder];}
to dismiss the keyboard when I begin scrolling the tableview on the search page. But there is a kink and a delay before the table can smoothly scroll. Help?
Upvotes: 0
Views: 596
Reputation: 277
UIKeyboardAnimationDurationUserInfoKey is a constant string identifier the animation duration, so there is where of enabling and disabling the animation.
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(willHideKeyboard:)
name:UIKeyboardWillHideNotification
object:nil];
- (void)willHideKeyboard:(NSNotification *)notification {
[UIView setAnimationsEnabled:NO];
}
hope this might help you.
Upvotes: 1
Reputation: 277
Try setting this on your tableView:
self.tableView.delaysContentTouches = NO;
[self.tableView.view endEditing:YES];
instead of
[searchBar resignFirstResponder];
That property defaults to YES. It delays touches to the content of the table view cells by a fraction of a second, to help it recognise the difference between a tap and a drag.
Upvotes: 2