1

I want the progress bar to increase when a "next button is pressed" as further in my code i have if, else statements saying,

@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"
    }
}
Raju Abe
  • 735
  • 2
  • 10
  • 25
Alicia I
  • 13
  • 1
  • 4

1 Answers1

1

First, outside the function, you need to set up the progress Bar Value.

progressBar.progress = 0

Then inside nextButton function, you can add more value to your progress bar.

@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" } }
Roma Kavinskyi
  • 268
  • 4
  • 12