Antony Ouseph
Antony Ouseph

Reputation: 552

UISeachcontroller is not working in UICollectionViewController

I added UISearchController in UICollectionViewController. But when I am typing in searchBar it dismiss the keyboard. How can I use the UISearchController in UICollectionViewController with UISearchResultsUpdating protocol.

I tried to filterSearch on UICollectionView items. When I call , self.collectionview.reloadData(), on each keypress the keyboard dismisses.

Upvotes: 5

Views: 100

Answers (1)

Manish Malviya
Manish Malviya

Reputation: 586

This is because when you call self.collectionView.reloadData() all delegate methods are called including viewForSupplementaryElementOfKind hence your textfield will resign first responder.

you can refer

CollectionViewWithSearchBar

Upvotes: 2

Related Questions