In dem Szenario, in dem Sie einen ViewController haben, den Sie als root view über alles andere darstellen möchten, was ist der richtige Weg, dies zu tun?Der richtige Weg, um einen ViewController als Root-View zu setzenController
let Storyboard = UIStoryboard.init(name: "Main", bundle: nil)
let MY_VIEW = Storyboard.instantiateViewControllerWithIdentifier("VIEWID")
//Is this the right way?
UIApplication.sharedApplication().delegate.window?.rootViewController?.presentViewController(MY_VIEW, animated: true, completion: nil)
//Or this?
UIApplication.sharedApplication().keyWindow?.rootViewController?.presentViewController(MY_VIEW, animated: true, completion: nil)
Mit anderen Worten, warum Sie UIApplication.sharedApplication().delegate.window?
über UIApplication.sharedApplication().keyWindow?.rootViewController?
und in welchen Szenarien verwenden würden? Was wären die Vor-/Nachteile der Verwendung des einen oder anderen?
Lese Unterschiede: [diffrences in keyWindow & Window] (http://stackoverflow.com/questions/21698482/diffrence- between-uiapplication-sharedapplication-delegate-window-and-u) – Chandan