How to add SearchBar in CollectionView? [closed]

2019-08-26 23:53发布

问题:

Trying to add a header SearchBar CollectionView, but get an error:

Illegal Configuration: Connection "searchBar" cannot have a prototype object as its destination.

回答1:

arrange your view like this, and its related delegate methods.



回答2:

Try to add the "searchBar" above the collection view not upon the header of the collection view. Think if the collectionView has multiple sections, it will definitely cause a problem while scrolling the collectionView, hence you need to add the searchBar just above the collectionView not upon it's header.