jjzjj

UICollectionReusableView

全部标签

ios - UICollectionReusableView 不显示

我已经添加了到我的收藏View并设置我的UICollectionView如下所示。[self.collectionViewregisterClass:[UICollectionViewCellclass]forCellWithReuseIdentifier:reuseIdentifier];[self.collectionViewregisterClass:[UICollectionReusableViewclass]forSupplementaryViewOfKind:UICollectionElementKindSectionHeaderwithReuseIdentifier:he

ios - 如何在不重新加载 header 的情况下重新加载 UICollectionView 中的单元格?

我正在尝试根据用户在header中的文本字段中输入的内容来更新UICollectionView中单元格的内容。我在这里查看了其他类似的问题,但他们的答案似乎都没有用。我什至尝试对UICollectionView进行扩展,它遍历该部分中的每个单元格,试图重新加载其数据,但这会导致崩溃,因为用户输入文本字段后单元格发生变化我试图解决问题的功能,我只有一个部分,所以我在那个部分硬编码@objcfunctextFieldDidChange(){guard(!(feedSearchBar.text?.isEmpty)!)else{VC.currentTagsArray=VC.genericTag

ios - UICollectionViewFlowLayout UICollectionReusableView DecorationView 不显示

我试图在UIViewController的每一行后面显示一个装饰View。每个“行”有3个UICollectionViewCells。我想通过三个单元格行后面的装饰View显示背景。在viewDidLoad:我正在注册装饰View:[self.collectionView.collectionViewLayoutregisterClass:[CollectionRowDecorationViewclass]forDecorationViewOfKind:@"RowDecorationView"];我还设置了以下委托(delegate)方法:-(UICollectionViewLayou

ios - 如何添加几个 UICollectionReusableView

我有两个不同的View需要在UICollectionView中实现。我的问题是如何使用Storyboard将两个UICollectionReusableView添加到UICollectionView?例如我可以将它添加为源代码:[self.collectionViewregisterClass:[HeaderViewclass]forSupplementaryViewOfKind:UICollectionElementKindSectionHeaderwithReuseIdentifier:@"HeaderView"];Storyboard中还有另一个标题,但是如何将两个UIColle

ios - CollectionView 方法 'referenceSizeForHeaderInSection' 引发异常

我正在尝试为我的collectionView创建具有动态高度的header。但是当我实现“referenceSizeForHeaderInSection”时,应用程序崩溃并出现以下异常:Terminatingappduetouncaughtexception'NSInternalInconsistencyException',reason:'couldnotdequeueaviewofkind:UICollectionElementKindSectionHeaderwithidentifierFeedHeader-mustregisteraniboraclassfortheidenti

ios - 如何访问从 UICollectionView 到 UICollectionReusableView 的导出?

在ViewController中注册的header:self.itemCollectionView.register(NewSubscriptionRequestCollectionReusableView.self,forSupplementaryViewOfKind:UICollectionView.elementKindSectionHeader,withReuseIdentifier:"NewSubscriptionRequestCollectionReusableView")在CollectionView委托(delegate)方法中:extensionUpcomingSub

ios - UICollectionView 标题宽度

在我的UICollectionViewFlowLayout子类中我有这个:self.headerReferenceSize=CGSizeMake(280,44);但是标题显示的宽度为320,这是CollectionView的宽度。根据文档,这是正确的:Duringlayout,onlythesizethatcorrespondstotheappropriatescrollingdirectionisused.Forexample,fortheverticalscrollingdirection,thelayoutobjectusestheheightvaluereturnedbyyou

ios - UICollectionView补充 View 如何正确插入或删除

简短的问题:有没有办法在performBatchUpdates:block中添加和删除补充View,例如单元格和部分,类似于insertItemsAtIndexPaths:deleteItemsAtIndexPaths:甚至reloadItemsAtIndexPaths:方法?详细解释:我使用带有部分的UICollectionView。单元格像网格一样布局,每行最多可以有6个单元格。如果单元格总数没有填满一个部分的所有行,我会添加额外的补充View。额外的补充View只是填补了空白空间。所以结果应该是每个部分都被所有可用的单元格完全填充,而(可能的)剩余的空白点被补充View填充。所以

ios - 使用 UICollectionReusableView 对单元格进行分组

我在将进行同步JSOn调用的旧代码更新为使用AFNetworking进行异步调用的新代码时遇到了问题。在我的旧代码中,我使用日期字符串(“release_date”)将单元格与UICollectionReusableView分组,所有这些都是在viewDidLoad中完成的。现在,使用AFNetworking,我将所有内容都从viewDidLoad中移出,所以我一直在努力弄清楚如何将我的旧代码与我的新代码合并。这是我必须使用AFNetworking解析我的JSON的新代码:-(void)viewDidLoad{[superviewDidLoad];self.upcomingReleas

ios - 如何为 UICollectionViewFlowLayout 中的每个单元格添加标题/标签补充 View ?

我见过的所有示例都使用补充View作为页眉或页脚。我需要在流程布局中的每个单元格上方和/或下方添加一个标签。起初我认为我所要做的就是注册一个类型的补充View类然后实现collectionViewForSupplementaryElementOfKindAtIndexPath我就可以开始了,但是开箱即用的FlowLayout似乎只支持页眉和页脚。Apple文档似乎暗示任何更多的东西都需要FlowLayout的子类化努力。由于我不想返工apple为流式布局所做的工作,并且由于我的单元格大小不同,我想扩展流式布局以支持每个单元格的支持View。我想我应该能够通过子类化UICollectio