StackedCardsContainer 2.0.3

StackedCardsContainer 2.0.3

Andrew维护。



  • 作者:
  • AndrewZub

StackedCardsContainer

CI Status Version License Platform

示例

要运行示例项目,请首先将仓库克隆,然后在示例目录中运行pod install

如何设置?

使用CocoaPods(推荐)

要安装,只需将以下行添加到您的Podfile中

pod 'StackedCardsContainer'

然后使用pod install命令进行安装。

Carthage (即将推出)

如何使用?

安装完成后,请将您的UIView子类设置为CardsViewContainer或在不同故事板中创建UIView并设置自定义类为CardsViewContainer

StackedCardsContainer customClassScreenShot

代理 & 数据源

最后一步是设置代理和数据源类。

恭喜你,现在你可以开始使用了。🎉

自定义

可自定义属性

  • public var offset: CGPoint

用于改变卡片开始点的属性。默认值为CGPoint(x: 20, y: 30)。

  • public let horizontalInset: CGFloat & public let verticalInset: CGFloat

这些属性用于水平方向和垂直方向的位置改变。默认值是CGPoint(x: 20, y: 30)。

  • public let numberOfVisibleCards: Int

用于在容器中设置可见卡片数量的属性。默认值为3。

卡片的初始化示例。你可以设置自定义视图、卡片的背景图片。使用支持的构造函数(Corners, CornersSizes)来设置角类型和剪切角的大小。

    func card(forItemAtIndex index: Int) -> CardView {
        let corners = Corners(topLeft: .straight, topRight: .rounded, bottomRight: .straight, bottomLeft: .cutOff)
        let cornersSizes = CornersSizes(topLeftCutOff: 70, topRightCutOff: 70, bottomLeftCutOff: 20, bottomRightCutOff: 30, offset: 10, radius: 10)
        cardsViewContainer.offset = CGPoint(x: 60, y: 70)
        let color = colorArray[index]
        let view = UIView()
        view.backgroundColor = .clear
        let cardView = CardView(frame: CGRect(x: 0, y: 0, width: cardsViewContainer.bounds.width - 50, height: cardsViewContainer.bounds.height - 10), color: color, customView: view, corners: corners, cornersSize: cornersSizes)
        return cardView
    }

作者

[email protected]

许可证

StackedCardsContainer遵循MIT许可证。有关更多信息,请参阅LICENSE文件。

StackedCardsContainer