I\'ve added a UISearchBar
to a UICollectionView
and in the delegate searchBar:textDidChange:
filter my model and call [collectio
The answer is to not reload the section which has the text field. I solved this problem by placing all items into a single search so it was possible to reload that single section.
The existing screen that I was modifying was showing the index on the right with the letters to navigate to each section which means there were many section which makes it harder to know how to reload each of those sections without messing up internal state. To make it work when the text field becomes the first responder the organization of the collection view changes to place all items into a single section which is reloaded when the search is run. Now the top section is not reloaded so it does not lose focus.
This way no undefined behavior is necessary like the other answers listed for this question.
https://github.com/brennanMKE/PullDownSearch