How do I present a view controller from AppDelegate?
Navigate From AppDelegate. swift to a Different ViewController
- Create an instance of UIStoryboard, let mainStoryboard:UIStoryboard = UIStoryboard(name: “Main”, bundle: nil)
- Instantiate View Controller with Identifier, HomeViewController.
- Set the Root View Controller of your app’s window to a different one.
How do I get to storyboard in AppDelegate?
If you use XCode 5 you should do it in a different way.
- Select your UIViewController in UIStoryboard.
- Go to the Identity Inspector on the right top pane.
- Check the Use Storyboard ID checkbox.
- Write a unique id to the Storyboard ID field.
How do I change initial view controller programmatically?
Open mainstoryboard, select the view that you want start first, then open Utilities–> Attributes. Below the “View Controller” you see the “Is initial View Controller” radio button. Just select it.
How do I change the initial view controller in Swift?
Programmatically Changing the Initial View Controller
- Clear the value of your program’s Main Storyboard File Base Name.
- Clear the value of Main Interface in your app’s General tab.
- In your app’s delegate’s application:didFinishLaunchingWithOptions: method: create the new Initial View Controller.
How do I change the initial view controller in storyboard?
Open your storyboard. Click on the view controller corresponding to the view that you want to be the default view. Open the Attributes Inspector. Check the Is Initial View Controller check box in the View Controller section.
Is initial view controller a storyboard?
Every storyboard file has an initial view controller that represents the default view controller to create. Typically, you use the initial view controller as the root view controller for a window. However, you can also instantiate the initial view controller when transitioning to content in a new storyboard file.
How do I get a view controller from storyboard?
In the Storyboard, select the view controller that you want to instantiate in code. Make sure the yellow circle is highlighted, and click on the Identity Inspector. Set the custom class as well as the field called “Storyboard ID”. You can use the class name as the Storyboard ID.