CreditCardView
示例
要运行示例项目,请克隆仓库,然后首先从示例目录运行 pod install
截图
全模板颜色定制
要求
至少需要 iOS 9.0。
安装
CreditCardView 可通过 CocoaPods 获得。要安装它,只需在 Podfile 中添加以下行
pod 'CreditCardView'
使用 CreditCardView
// Colors for Examples
let c1:UIColor = UIColor(rgb: 0x7CEA9C)
let c2:UIColor = UIColor(rgb: 0x2FB799)
let c3:UIColor = UIColor(rgb: 0x454851)
let c4:UIColor = UIColor(rgb: 0x6F73D2)
let c5:UIColor = UIColor(rgb: 0x98C1D9)
// Examples of Different Templates
// Basic - Template
card1 = CreditCardView(frame: CGRect(x: 0 y: 0, width: 390, height: 215), template: .Basic(c1, c2, c3))
// Curve - Template
card2 = CreditCardView(frame: CGRect(x: 0 y: 0, width: 390, height: 215), template: .Curve(c1, c2, c3, c4, c5))
// Gradient - Template
card3 = CreditCardView(frame: CGRect(x: 0 y: 0, width: 390, height: 215), template: .Gradient(c1, c2))
// Flat - Template
card4 = CreditCardView(frame: CGRect(x: 0 y: 0, width: 390, height: 215), template: .Flat(c3))
// Change Card Details
creditCardView.nameLabel.text = "Jean-Marc Boullianne"
creditCardView.expLabel.text = "02/30"
creditCardView.numLabel.text = "1111 2222 3333 4444"
creditCardView.brandLabel.text = "VISA"
creditCardView.brandImageView.image = UIImage()
// You can also create your own custom background like this
creditCardView.backgroundView = //Custom Background View
作者
jboullianne,[email protected]
许可证
CreditCardView 在 MIT 许可证下可用。更多信息请参阅 LICENSE 文件。