相关疑难解决方法(0)

如何使用swift在集合视图中创建页眉和页脚

如何在swift中的集合视图中创建页眉和页脚?

我正在尝试将页眉和页脚组合在一起,但它一直在崩溃,我找不到快速的教程来理解它.

我不知道如何只返回一个补充视图.

我在故事板上设置它们(类+标识符)

 override func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int {
    //#warning Incomplete method implementation -- Return the number of sections
    return 2
}


override func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
    //#warning Incomplete method implementation -- Return the number of items in the section
    return 10
}




override func collectionView(collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, atIndexPath indexPath: NSIndexPath) -> UICollectionReusableView {
    var header: headerCell!
    var footer: footerCell!



    if kind == UICollectionElementKindSectionHeader {
        header =
            collectionView.dequeueReusableSupplementaryViewOfKind(kind,
                withReuseIdentifier: "header", forIndexPath: …
Run Code Online (Sandbox Code Playgroud)

ios uicollectionview swift

43
推荐指数
6
解决办法
6万
查看次数

标签 统计

ios ×1

swift ×1

uicollectionview ×1