首页 > 解决方案 > 在collectionview之外访问Collectionview footerviewcell

问题描述

如何访问footerview外部的按钮collectionview

有谁知道如何从外部访问该按钮collectionView

func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView
 {

    switch kind {

        case UICollectionElementKindSectionHeader:
            let header = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "cellHeader", for: indexPath) as! CollectionReusableView
            return header

        case UICollectionElementKindSectionFooter:
            let footer = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "cellFooter", for: indexPath) as! CollectionReusableView

            return footer

        default:
            print("anything")
        }

        return UICollectionReusableView()
    }

任何帮助将不胜感激。

标签: swiftuicollectionview

解决方案


推荐阅读