APECountdownView 0.1.2

APECountdownView 0.1.2

测试已测试
语言语言 SwiftSwift
许可 MIT
发布最新发布2016 年 2 月
SPM支持 SPM

Daniel Nilsson 维护。



 
依赖关系
RxSwift~> 2.2
RxCocoa~> 2.2
 

APECountdownView

一个简单易用的倒计时视图。

Countdown

要求

  • iOS 8 或以上。
  • Xcode 7 或以上。

安装

使用界面构建器

  • 将 UIView 拖放到您的 storyboard(或 nib 文件)中。
  • 将类更改为 CountdownView。
  • 您现在可以直接从 Interface builder 修改外观。

使用代码

不要忘记导入。

import APECountdownView

从界面构建器连接您的倒计时视图

@IBOutlet weak var countdownView: CountdownView!

开始倒计时

let days = 86400000.0 * 20  // 20 days
let hours = 3600.0 * 20     // 20 hours
let minutes = 60.0 * 20     // 20 minutes
let seconds = 1.0 * 20      // 20 seconds

let endDate = NSDate(timeIntervalSinceNow: days + hours + minutes + seconds)
countdownView.startCountdown(endDate, onCompleted: { _ in
    print("Countdown completed!")
})

更改外观

countdownView.size = CGSize(width: 30, height: 40)
countdownView.groupSpace = -3
countdownView.sectionSpace = 3
countdownView.gradientColor1 = UIColor(red: 0.290, green: 0.290, blue: 0.290, alpha: 1.000)
countdownView.gradientColor2 = UIColor(red: 0.153, green: 0.153, blue: 0.153, alpha: 1.000)
countdownView.gradientColor3 = UIColor(red: 0.071, green: 0.071, blue: 0.071, alpha: 1.000)
countdownView.gradientColor4 = UIColor(red: 0.004, green: 0.004, blue: 0.004, alpha: 1.000)
countdownView.blockFont = UIFont.boldSystemFontOfSize(16)
countdownView.blockFontColor = UIColor.whiteColor()
countdownView.titleFont = UIFont.systemFontOfSize(10)
countdownView.titleFontColor = UIColor.blackColor()

贡献

欢迎所有人贡献。请参阅 CONTRIBUTING 获取详细信息。

许可

APECountdownView 在 MIT 许可下发布。请参阅 LICENSE 获取详细信息。