Einfacher Weg für die Navigation.
Richten Sie Ihre didFinishLaunchingWithOptions
wie folgt ein.
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
let storyboard :UIStoryboard
if UIDevice.currentDevice().userInterfaceIdiom == .Pad{
storyboard = UIStoryboard(name: "Main_iPad", bundle: nil)
}
else{
storyboard = UIStoryboard(name: "Main", bundle: nil)
}
let navigationController:UINavigationController = storyboard.instantiateInitialViewController() as! UINavigationController
let objLoginViewController:UIViewController = storyboard.instantiateViewControllerWithIdentifier("ID_LoginViewController") as! LoginViewController
navigationController.viewControllers = [objLoginViewController]
if self.window != nil {
self.window!.rootViewController = navigationController
}
return true
}
Diese Funktion aufrufen, sobald die Antwort erfolgreich ist.
self.redirectToNewViewcontroller()
-Code für redirectToNewViewcontroller Funktion
func redirectToNewViewcontroller()
{
let objNewViewController = self.storyboard?.instantiateViewControllerWithIdentifier("ID_NewViewController") as? NewViewController
self.navigationController?.pushViewController(objNewViewController!, animated: true)
}
Ist "Login erfolgreich" gedruckt, in Consol e? – iDeveloper
Was passiert, wenn dieser Code ausgeführt wird? Warum verwenden Sie Sync statt Async? – Paulw11
Ja Login erfolgreich ist Drucken in der Konsole – Mamta