I have set up an alertcontroller for my app, the way it works is if section score is higher than 10, you get a ui alert.
Now My problem is that if i have 2 or 3 sections over 10, I only get the first UIalert to show, id like to see all of them one after the other (if this sutuation happens
here is my code :
func SectionAlert () {
var message1 = NSLocalizedString("Section 1 score is now ", comment: "");
message1 += "\(section1score)";
message1 += NSLocalizedString(" please review before continuing", comment: "1");
var message2 = NSLocalizedString("Section 2 score is now ", comment: "");
message2 += "\(section2score)";
message2 += NSLocalizedString(" please review before continuing", comment: "2");
var message3 = NSLocalizedString("Section 3 score is now ", comment: "");
message3 += "\(section3score)";
message3 += NSLocalizedString(" please review before continuing", comment: "3");
if (section1score >= 10){
let alertController: UIAlertController = UIAlertController(title: NSLocalizedString("Section 1 score is over 10", comment: ""),
message: " \(message1)",
preferredStyle: .Alert)
let OKAction = UIAlertAction(title: "OK", style: .Default) {
action -> Void in }
alertController.addAction(OKAction)
self.presentViewController(alertController, animated: true, completion: nil)
} else if (section2score >= 10){
let alertController: UIAlertController = UIAlertController(title: NSLocalizedString("Section 2 Score is over 10", comment: ""),
message: "\(message2)",
preferredStyle: .Alert)
let OKAction = UIAlertAction(title: "OK", style: .Default) {
action -> Void in }
alertController.addAction(OKAction)
self.presentViewController(alertController, animated: true, completion: nil)
} else if (section3score >= 10){
let alertController: UIAlertController = UIAlertController(title: NSLocalizedString("Section 3 Score is over 10", comment: ""),
message: "\(message3)",
preferredStyle: .Alert)
let OKAction = UIAlertAction(title: "OK", style: .Default) {
action -> Void in }
alertController.addAction(OKAction)
self.presentViewController(alertController, animated: true, completion: nil)
}
}
any ideas ??
thanks !
OK, I've figured it out, what I've done is get the code to be ran when I press OK on the view , so that it checks the other sections then pops another one if need be.
I've putted it in after
thanks a lot