Reputation: 85
I have 2 view controller ,and I disabled the initial view controller of first view controller ,and enabled the second view controller,but when start the project,the initial view controller is still the first view controller ,what should I do? Thanks!
Upvotes: 7
Views: 11412
Reputation: 19385
If you are starter like me ( both iOS and OSX mechine ) and you wanted to change the entry point within same storyboard, then,
-> long press on the entry point arrow. -> drag it to the view controller you wish to make the starting point, the arrow will now move to your new screen.
Upvotes: 1
Reputation: 14571
Alternatively you can do this with code too.
In your AppDelegate
class's didFinishLaunchingWithOptions
method you can write
let storyBoard = UIStoryboard(name: "Main", bundle: nil)
let secondVC = storyBoard.instantiateViewControllerWithIdentifier("SecondViewController") as! SecondViewController
self.window?.rootViewController = secondVC
Edit
Swift 3.0
let storyBoard = UIStoryboard(name: "Main", bundle: nil)
let secondVC = storyBoard.instantiateViewController(withIdentifier: "SecondViewController") as! SecondViewController
self.window?.rootViewController = secondVC
Assuming that your storyboard name is Main.Storyboard
and your SecondViewController Storyboard ID and Restoration ID is also set in Identity Inspector and use Storyboard ID is checked.
Upvotes: 1
Reputation: 2217
Tap the second view controller, and select "Is initial View Controller"
in Attributes inspector
.
Upvotes: 13