I use UICollectionView, and I want to add to it UISearchBaror UISearchDisplayController. I can do it. I want, please, an example.
- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath
{
UICollectionReusableView *reusableview = nil;
if (kind == UICollectionElementKindSectionHeader) {
CollectionReusable *headerView = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"HeadCell" forIndexPath:indexPath];
reusableview = headerView;
}
if (kind == UICollectionElementKindSectionFooter) {
CollectionReusable *footerView = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionFooter withReuseIdentifier:@"FootCell" forIndexPath:indexPath];
reusableview = footerView;
}
return reusableview;
}
source
share