Add UISearchBar in UICollectionViewController header

Hi, I want to add a search option at the top of the UICollectionViewController . I tried some codes from here, but it does not work for me.

What i have done so far:

  • Created by UICollectioViewController
  • Then check the box for the title
  • Add UITextfield to title bar
  • Created a UICollectionViewReusablecell , and then declared my UISearchBar .

But I don’t know how to take the value from this UITextfield and check with the values ​​in my array “All details” and display the results in a table?

Currently in UICollectionViewCell I am using this code to enter text in a UITextfield :

 [searchTextfield addTarget:self action:@selector(check:) forControlEvents:UIControlEventEditingChanged]; 

Please check this link below. I did not understand this, maybe you can help me.

 http://www.appcoda.com/supplementary-view-uicollectionview-flow-layout/ 
+4
source share
1 answer

Please find the links below with sample codes on Github. You can download and integrate UICollectionView with UISearchBar using these links.

https://maniacdev.com/2015/01/example-how-to-integrate-uicollectionview-with-uisearchbar

Search and filter cells in UICollectionView

0
source

All Articles