Swift: 在进度视图完成时更改标签文本 1.0
Swift: Change the Label text while progress view is complete 1.0
我有一个带有标签的 progressView。当页面加载时,进度条开始使用值 0.0 和 1.0。这是我的 progressView 代码。
函数
@objc func updateProgress() {
progressValue = progressValue + 0.01
self.progressView.progress = Float(progressValue)
if progressValue != 1.0 {
progressView.isHidden = false
self.perform(#selector(updateProgress), with: nil, afterDelay: 0.2)
}
}
调用下方ViewDidLoad广告中的函数
self.perform(#selector(updateProgress), with: nil, afterDelay: 0.2)`
当我的进度视图完成其过程或它的值变为 1.0 时,我希望将标签文本从 "Wait a while" 更改为 "Enter OTP Manually"。
当前的 if-statement
看起来不错,但我会继续这样做以避免任何 float
舍入问题,
if progressValue < 1.0 { // Considering 1.0 is the max value.
progressView.isHidden = false
self.perform(#selector(updateProgress), with: nil, afterDelay: 0.2)
} else {
self.label.text = "Enter OTP Manually"
}
我有一个带有标签的 progressView。当页面加载时,进度条开始使用值 0.0 和 1.0。这是我的 progressView 代码。
函数
@objc func updateProgress() {
progressValue = progressValue + 0.01
self.progressView.progress = Float(progressValue)
if progressValue != 1.0 {
progressView.isHidden = false
self.perform(#selector(updateProgress), with: nil, afterDelay: 0.2)
}
}
调用下方ViewDidLoad广告中的函数
self.perform(#selector(updateProgress), with: nil, afterDelay: 0.2)`
当我的进度视图完成其过程或它的值变为 1.0 时,我希望将标签文本从 "Wait a while" 更改为 "Enter OTP Manually"。
当前的 if-statement
看起来不错,但我会继续这样做以避免任何 float
舍入问题,
if progressValue < 1.0 { // Considering 1.0 is the max value.
progressView.isHidden = false
self.perform(#selector(updateProgress), with: nil, afterDelay: 0.2)
} else {
self.label.text = "Enter OTP Manually"
}