[:en]Swift: Go to other screen[:]

[:en]Command to go from one screen to the other

   // go to Menu Screen
    func Gotomenuscreen() {
        NSOperationQueue.mainQueue().addOperationWithBlock {
            if let levelRecalled = NSUserDefaults.standardUserDefaults().stringForKey("level") {
            let userlevel = levelRecalled.stringByReplacingOccurrencesOfString(" ", withString: "");
            
            if userlevel == "all" {
                let nextViewController = self.storyboard?.instantiateViewControllerWithIdentifier("mainmenu") as! MainMenuViewController
                self.presentViewController(nextViewController, animated:true, completion:nil)
            }
            else if userlevel == "admin" {
                let nextViewController = self.storyboard?.instantiateViewControllerWithIdentifier("mainmenu") as! MainMenuViewController
                self.presentViewController(nextViewController, animated:true, completion:nil)
            }
                
            else if userlevel == "teacher" {
                let nextViewController = self.storyboard?.instantiateViewControllerWithIdentifier("mainmenu") as! MainMenuViewController
                self.presentViewController(nextViewController, animated:true, completion:nil)
            }
            else {
                let nextViewController = self.storyboard?.instantiateViewControllerWithIdentifier("Menu") as! MenuViewController
                self.presentViewController(nextViewController, animated:true, completion:nil)
            }
            }
        }
    }
)

[:]

Print Friendly, PDF & Email
Scroll to Top