UIStoryboard
An encapsulation(封装)of the design-time view controller graph represented in an Interface Builder storyboard resource file.
On This Page
Declaration
class UIStoryboard : NSObject
Overview
A storyboard represents the view controllers for all or part of your app’s user interface. Typically, view controllers in a storyboard are instantiated and created automatically in response to actions defined within the storyboard itself. However, you can use a storyboard object to instantiate the initial view controller in a storyboard file or instantiate other view controllers that you want to present programmatically.
Topics
Getting a Storyboard Object
init(name: String, bundle: Bundle?)
Creates and returns a storyboard object for the specified storyboard resource file.
Instantiating Storyboard View Controllers
func instantiateInitialViewController() -> UIViewController?
Instantiates and returns the initial view controller in the view controller graph.
func instantiateViewController(withIdentifier: String) -> UIViewController
Instantiates and returns the view controller with the specified identifier.
let vc = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "shoppingCart")
vc.navigationItem.title = self.navigationItem.rightBarButtonItem?.title
self.navigationController?.pushViewController(vc, animated: true)