jjzjj

viewForSupplementaryElementOfKind

全部标签

ios - 未使用 Firebase UI 数据源调用 UICollectionView viewForSupplementaryElementOfKind

我正在尝试将header添加到使用FirebaseUI绑定(bind)到firebase查询的CollectionView。我使用集合标题的静态框架设置我的CollectionView。(我已经尝试使用委托(delegate)调用sizeForHeaderInSection而不是布局中的静态框架集的CollectionView。viewForSupplementaryElementOfKind的委托(delegate)方法无论如何都不会被调用。):lazyvarcollectionView:UICollectionView={letlayout=UICollectionViewFlow

ios - 从 UICollectionView 的 viewForSupplementaryElementOfKind 获取 NSFetchedResultsController 部分对象

我有一个名为Location的数据模型。我将它们用作UICollectionViewController中的部分标题。每个location都可以在这些部分中显示items。我想在viewForSupplementaryElementOfKind中自定义我的部分标题。但我无法弄清楚如何从此方法接收正确的Location对象。我试过类似的东西:-(UICollectionReusableView*)collectionView:(UICollectionView*)collectionViewviewForSupplementaryElementOfKind:(NSString*)kind

ios - 未在自定义 UICollectionViewLayout 上调用 viewForSupplementaryElementOfKind

我创建了一个自定义UICollectionViewLayout并将其放入Storyboard中的CollectionViewController中。我在显示项目/单元格时没有遇到太多问题。我的问题是viewForSupplementaryElementOfKind没有被调用。我似乎无法确定为什么会这样。我试图回到默认布局,然后它确实调用了它,但我需要我的自定义UICollectionViewLayout。我已将NSLog留给检查,viewForSupplementaryElementOfKind未被调用。这是我的MyCollectionViewController.m-(void)vi

ios - 未在自定义 UICollectionViewLayout 上调用 viewForSupplementaryElementOfKind

我创建了一个自定义UICollectionViewLayout并将其放入Storyboard中的CollectionViewController中。我在显示项目/单元格时没有遇到太多问题。我的问题是viewForSupplementaryElementOfKind没有被调用。我似乎无法确定为什么会这样。我试图回到默认布局,然后它确实调用了它,但我需要我的自定义UICollectionViewLayout。我已将NSLog留给检查,viewForSupplementaryElementOfKind未被调用。这是我的MyCollectionViewController.m-(void)vi

ios - Collection View :viewForSupplementaryElementOfKind:atIndexPath: called only with UICollectionElementKindSectionHeader

我有一个CollectionView,我希望每个部分都有页眉和页脚。我正在使用默认流布局。我有自己的UICollectionReusableView子类,我在ViewController的viewDidLoad方法中为页眉和页脚注册了每个子类。我已经实现了方法collectionView:viewForSupplementaryElementOfKind:atIndexPath:但是,对于每个部分,它仅在kind为UICollectionElementKindSectionHeader时被调用.因此我的页脚甚至都没有创建。知道为什么会这样吗? 最佳答案

ios - 从 collectionView 返回什么(_ :viewForSupplementaryElementOfKind:at:) when you want to return nothing?

我有一个UICollectionView,它有部分标题,但没有部分页脚。因此,我没有定义的页脚View。Apple'sdocumentation声明您不得从此方法返回nil。funccollectionView(_collectionView:UICollectionView,viewForSupplementaryElementOfKindkind:String,atindexPath:IndexPath)->UICollectionReusableView{switchkind{caseUICollectionElementKindSectionHeader:letheaderVi