Search code examples
swiftxcodecocoastoryboardnsviewcontroller

Change window root view controller


I am using Xcode 8 on macOS 10.11.6 for a Cocoa Application development. By defaut, the root viewcontroller of the main window in story board is connected to a single NSViewController object, and I can find the segue defined in the IB oabel. However, If I delete the segue and try to bring another ViewController as the root viewcontroller, i can not just drag a segue from the window to the destination viewcontroller, nor can I manully add segue in the IB panel. Is programming the only way to change the window root view controller?


Solution

  • To make any View Controller your initial View Controller you just have to select it on the storyboard and go the View > Utilities > Show Attributes Inspector (shortcut CMD+ALT+4) and check on the "is initial View Controller" box.