iosuitableviewkeyboardscroll

Hide keyboard when scroll UITableView


In my app I want to hide keyboard when I start scrolling any UITableView or scroll view.


Solution

  • Not sure why you need to subclass UITableView for this.

    In the view controller that contains the plain UITableView, try adding this:

    - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
    {
        [searchBar resignFirstResponder];
    }