I have a UICollectionView with a header, some cells and a footer supplementary views. The header contains a UISearchBar. If I type something into the search field, the keyboard automatically dismisses after the first letter. I think it is caused by my -searchBar:textDidChange:, which contains code for refreshing the collection view (via -reloadData, because this is the only method I know which works).
My theory is, that reloading the UICollectionView causes it to become first responder, but that somehow does not work.
I have this line in my output every time the keyboard dismisses:
setting the first responder view of the collection view but we don't know its type (cell/header/footer)
I attempted to overwrite UICollectionView's -canBecomefirstResponder, but unfortunately that didn't work.
Any ideas how can I prevent UICollectionView to become the first responder after the reload?
I've had luck restoring the search bar as the first responder after updating the table view:
collectionView.reloadData()
searchBar.becomeFirstResponder()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With