Okay..here's the problem. When I click the [Play] button in the main menu, it should go to the corresponding ViewController according to this code:
@IBAction func playButton(sender: AnyObject) {
if rightCounter <= 4 {
if let Level1 = self.storyboard!.instantiateViewControllerWithIdentifier("Level1") as? Level1 {
self.presentViewController(Level1, animated: true, completion: nil)
}
}
if rightCounter >= 5 && rightCounter <= 9 {
if let Level2 = self.storyboard!.instantiateViewControllerWithIdentifier("Level2") as? Level2 {
self.presentViewController(Level2, animated: true, completion: nil)
}
}
}
The code works perfect! No errors! But when the rightCounter is 9, it still takes me to the first ViewController. Actually it should be taking me to the second ViewController. That's where we have to fix. Btw, thanks in advance.
And during that time, I get this error too..
Warning: Attempt to present <GuessMeFinal.Level2: 0x79eb7500> on <GuessMeFinal.ViewController: 0x7ac62180> whose view is not in the window hierarchy!
I have connected the mainViewController to the Level1 and Level2 ViewControllers. So, should I use another code to solve my problem, or please help me out here!