Sam*_*amy 7 xcode uiprogressview swift ios13
我没有看到UIProgressViewXcode 11.0/Swift 5/iOS 13的动画:
private let timerProgressView: UIProgressView = {
let timerProgressView = UIProgressView()
timerProgressView.progressTintColor = white
timerProgressView.trackTintColor = .black
timerProgressView.setProgress(1.0, animated: false)
return timerProgressView
}()
private func triggerProgressView() {
UIView.animate(withDuration: viewModel.timeLimit, delay: 0.0, options: .curveLinear, animations: { [weak self] in
self?.timerProgressView.setProgress(0.0, animated: true)
}, completion: nil)
}
Run Code Online (Sandbox Code Playgroud)
此代码适用于 iOS <12,但不适用于 iOS 13。我错过了什么吗?
我们也遇到过这个问题,经过大约一个小时的努力,我们想出了一个解决方法,看起来这是一个错误。这很荒谬,但是将进度设置为 0.0001 而不是 0.0 就可以了。
progressView.progress = 0.0001
UIView.animate(withDuration: duration,
delay: 0.0, options: [.curveLinear, .beginFromCurrentState, .preferredFramesPerSecond60],
animations: { progressView.layoutIfNeeded() },
completion: nil)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1560 次 |
| 最近记录: |