单击按钮时如何使进度条增加? Swift
How do you make progress bar increase when button is clicked ? Swift
我希望进度条在 "next button is pressed" 时增加,因为在我的代码中有 if, else 语句说
@IBAction func nextButton(_ sender: UIButton) {
if progressBar.progress == Float(0.25) {
labelText.text = "first label"
}
else if progressBarCY.progress == Float(0.50) {
labelText.text = "second label"
}
}
首先在函数外,需要设置进度条值
progressBar.progress = 0
然后在 nextButton 函数中,您可以为进度条添加更多值。
@IBAction func nextButton(_ sender: UIButton) {
progressBar.progress += 0.25
if progressBar.progress == 0.25 {
labelText.text = "first label" }
else if progressBar.progress == 0.50 {
labelText.text = "second label" } }
我希望进度条在 "next button is pressed" 时增加,因为在我的代码中有 if, else 语句说
@IBAction func nextButton(_ sender: UIButton) {
if progressBar.progress == Float(0.25) {
labelText.text = "first label"
}
else if progressBarCY.progress == Float(0.50) {
labelText.text = "second label"
}
}
首先在函数外,需要设置进度条值
progressBar.progress = 0
然后在 nextButton 函数中,您可以为进度条添加更多值。
@IBAction func nextButton(_ sender: UIButton) {
progressBar.progress += 0.25
if progressBar.progress == 0.25 {
labelText.text = "first label" }
else if progressBar.progress == 0.50 {
labelText.text = "second label" } }