How to filter UICollectionView and keep keyboard up?
问题 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? 回答1: In searchBar delegate function , I use performBatchUpdates, first