Reputation: 13
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"
}
}
Upvotes: 1
Views: 4537
Reputation: 313
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" } }
Upvotes: 1