我的cocoaPod库HFCardCollectionViewLayout问题

时间:2019-10-15 07:24:59

标签: swift xcode cocoapods

我发现了一个惊人的库,它和我想要的一样,都是cardHolder:

screenshot of the card holder

但是我什至不知道如何使用它。我将其集成到我的项目中。创建一个CollectionView并从HFCardCollectionViewLayout成功。现在我有类似this的东西:)

我的代码看起来像

{
  import UIKit
  import HFCardCollectionViewLayout

class ViewController: UIViewController {

    @IBOutlet weak var cardsCollectionView: HFCardCollectionViewLayout!

    override func viewDidLoad() {
        super.viewDidLoad()

    }

}

我无法理解如何装饰此collectionView,因为我没有使用此类库,并且HFCardCollectionViewLayout没有DataSource和DelegateFlowLayout?我应该使用CollectionViewDelegateFlowLayout和DataSorce吗?我该怎么办?任何信息都应该有用。

1 个答案:

答案 0 :(得分:0)

基本上,您没有dataSourcedelegateFlowLayout,因为HFCardCollectionViewLayoutDelegate实现了UICollectionViewDelegate,而HFCardCollectionViewLayout实现了UICollectionViewLayout和{ {1}}。

您可以检查Readme here

HFCardCollectionViewLayout有一个非常简单的实现示例。要运行它:

1)在计算机上克隆pod存储库:

UIGestureRecognizerDelegate

2)打开git clone https://github.com/hfrahmann/HFCardCollectionViewLayout 文件夹,然后打开HFCardCollectionViewLayoutExample文件;

3)运行项目。实现在HFCardCollectionViewLayoutExample.xcworkspaceExampleViewController.swift中。您还可以查看源代码here

enter image description here