BT-Timer
Timer
设置
1- 初始化 BTtimer 指定...
- 应链接到该标签的标签。
- 应倒计时的时间。
- 标签是否应动画。
let timer:BTtimer!
override func viewDidLoad() {
...
timer = BTtimer(for: label, withTimeInSecs: 1 * 60 * 60, animate: true)
}
2- 控制 计时器
timer.fire()
timer.pause()
timer.stop()
timer.reset()
3- 实现 BTtimerDelegate 并提供以下可用函数...
extension UIViewController : BTtimerDelegate {
public func didStart() { }
public func didTick(with secondsLeft: Int) { }
public func didTimeOutWhileInBackground(since secondsPassed: Int) { }
public func didTimeOut() { }
}
计时器
设置
1- 初始化 BTstopwatch 指定...
- 应链接到该标签的标签。
- 标签是否应动画。
stopwatch:BTstopwatch!
override func viewDidLoad() {
...
stopwatch = BTstopwatch(for: label, animated: true)
}
2- 控制 计时器
stopwatch.fire()
stopwatch.pause()
stopwatch.stop()
stopwatch.restart()
3- 实现 StopwatchDelegate 并提供以下可用函数...
extension UIViewController : StopwatchDelegate {
public func stopwatchWasInterrupted(at timePassedInSec:Int) { }
}
安装
BT-Timer 可以通过 CocoaPods 获取。要安装它,只需将以下行添加到您的 Podfile 中:
pod 'BT-Timer'
作者
Omar Labib,[email protected]
版权许可
BT-Timer 遵循 MIT 许可协议。有关更多信息,请参阅 LICENSE 文件。