【问题标题】:Circular Progress Timer Animation in Swift 2Swift 2 中的循环进度计时器动画
【发布时间】:2016-06-20 13:32:37
【问题描述】:

我正在尝试使用 MBCircularProgress 框架来创建动画循环计时器。我不确定如何将它与我设置的时间联系起来(我正在使用 MZTimerLabel 框架)。这是我目前所拥有的:

// workout time
let workoutTimeLong = 30.0

// the view of type MBCircularProgressBarView
@IBOutlet weak var progressTimer: MBCircularProgressBarView!

//the timer label
@IBOutlet weak var timerLabel: MZTimerLabel!

self.progressTimer.setValue(55, animateWithDuration: 1)

我确实查看了给定的方法,但这是我在 Swift 中的第一个项目,所以我不知道如何通过代码连接它。上面的代码给了我一个“线程 1:EXC_BAD_INSTRUCTION”错误。谢谢。

【问题讨论】:

  • 我什至不知道 MBCircularProgress 是什么。可以吃吗?
  • 我在我的 OP 中提到它是一个框架。

标签: ios xcode swift animation timer


【解决方案1】:

您需要确保在文件顶部有这一行。

import MBCircularProgressBar

我不完全理解您将其与您设置的时间联系起来的意思,但它可能看起来像这样。

progressBar.setValue(CGFloat(workoutTimeLong), animateWithDuration: 1.0)

【讨论】:

  • 谢谢,这很有帮助,但我得到了 Thread 1: EXC_BAD_EXECUTION 错误,这就是为什么我对我的实现持怀疑态度。视图也没有出现。有没有我错过的额外步骤?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-05-08
  • 1970-01-01
  • 2013-03-05
  • 2023-04-03
  • 2016-03-15
  • 1970-01-01
相关资源
最近更新 更多