How to filter UICollectionView and keep keyboard up?

ios, keyboard, reloaddata, uicollectionview, uisearchbar

Solution

In searchBar delegate function , I use performBatchUpdates, first,reload collectionView then call [self.searchBar becomeFirstResponder] to display keyboard

- (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar{
    [self setEditing:NO animated:YES];
    [searchBar setShowsCancelButton:YES animated:YES];

        [self.collectionView performBatchUpdates:^{
            [self.collectionView reloadData];
        } completion:^(BOOL finished) {
            [self.searchBar becomeFirstResponder];
        }];
}

Problem

I've added a `UISearchBar` to a `UICollectionView` and in the delegate `searchBar:textDidChange:` filter my model and call `[collectionView reloadData]`. `reloadData` (as well as reloadSection, etc) wants to take away firstResponder from the searchbar's textfield, thus dismissing the keyboard. I am trying to build a "live updating" filter and so it's annoying to have the keyboard go away after each character typed. Any ideas?

Original source

Related problems