I know how to make a view controller the root view controller of the app by this code:
window.rootViewController = (your root view controller())
but I saw also this:
instantiateInitialViewController
and this:
instantiateViewController(withIdentifier:)
are they the same as rootViewController or they have different functionalities?
instantiateInitialViewController
instantiates the view controller marked as initial in a given storyboard. There can be only one initial view controller per storyboard.instantiateViewController(withIdentifier:)
instantiates the view controller with a matching identifier from a given storyboard. Both methods can be used to instantiate a root view controller, but also non-root view controllers you'd want to present later in the app.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.