How can I add a search bar above a UICollectionView?

前端 未结 2 1445
栀梦
栀梦 2021-02-14 00:43

I would like to allow users of my app to search for images using a UISearchBar above a UICollectionView. According to my understanding, a UIColle

2条回答
  •  不知归路
    2021-02-14 00:54

    It is not mandatory to have UICollectionView inside UICollectionViewController. UICollectionView is just like UITableView and can be added anywhere. All you need to do is implement UICollectionViewDelegate and UICollectionViewDataSource protocols. You can follow following tutorial Supplementary Header and add search bar as a supplementary header of UICollectionView.

提交回复
热议问题