gpt4 book ai didi

uicollectionview - 我们可以将 UISearchBar 添加到 UICollectionView header 吗

转载 作者:行者123 更新时间:2023-12-01 06:50:36 27 4
gpt4 key购买 nike

我正在使用 UICollectionView我想添加 UISearchBarUISearchDisplayController到它。
我可以这样做吗。我想要一些例子。

- (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;
}

最佳答案

有点晚了但是this repository包含处理此问题的大量代码。

关于uicollectionview - 我们可以将 UISearchBar 添加到 UICollectionView header 吗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21727316/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com