At the moment I have a simple UICollectionReusableView Class implemented on the CollectionView header cell:
class SearchBarCollectionReusableView: UICollectionReusableView {
@IBOutlet weak var searchBar:UISearchBar!
@IBOutlet weak var filterSegCtrl:UISegmentedControl!
override init(frame: CGRect) {
super.init(frame: frame)
}
required init(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
}
I then add this to my UICollectionViewClass to show the header below:
override func collectionView(collectionView: UICollectionView!, viewForSupplementaryElementOfKind kind: String!, atIndexPath indexPath: NSIndexPath!) -> UICollectionReusableView! {
var reusableview:UICollectionReusableView!
if kind == UICollectionElementKindSectionHeader {
let headerView:SearchBarCollectionReusableView = collectionView.dequeueReusableSupplementaryViewOfKind(UICollectionElementKindSectionHeader, withReuseIdentifier: "SearchBar", forIndexPath: indexPath) as SearchBarCollectionReusableView
reusableview = headerView
}
return reusableview
}
How do i get access to the UISearchBar properties including delegates and text in my UICollectionViewClass ?