lundi 23 février 2015

UIAlert Troubles

I am trying to have a UIAlert show up if the user taps the button and the label text is 0. I want the button to change the labels text to 0 after the button is clicked. When I tried to do this the UIAlert comes up when I don't want it to. Here is my code for the button:



@IBAction func checkButton(sender: UIButton) {

if (currentCountLabel == "0"){

let alert = UIAlertView()
alert.title = "Alert"
alert.message = "You must type in an answer in order to check it"
alert.addButtonWithTitle("Understood")
alert.show()

}

currentCount *= 0
currentCountLabel.text = "\(currentCount)"

}


How do I get the button to change the label's text to 0 but not have the error go off when the text is changed?


Thanks in Advance.


Aucun commentaire:

Enregistrer un commentaire