Search code examples
iphonexcoderootview

Set root controller with interface builder


When I drag a Navigation Controller on to the storyboard I get the Navigation Controller and a Table View Controller. I do not want the table view, so I delete it, insert a regular view controller, change its class to e.g LoginView, right-click and drag: "Relationship Root View Controller" from the Navigation Controller on to the View Controller.

Now when I run the application I get

Application windows are expected to have a root view controller at the end of application launch

I do not want to fix this programatically, since last time I did this it worked out of the box (xcode 4.2, now I upgraded to 4.3). Also, when adding the Navigation Controller in 4.2 it came with a View Controller, not a Table View Controller.

Navigation Controller has "Is Initial View Controller" set.


Solution

  • Try doing it the other way around.

    • Delete the navigation controller
    • Select the lasting view controller, in the menu "Editor > Embed in > Navigation Controller"
    • Check if the navigation controller has "Is Initial View Controller" selected
    • Check if in the AppDelegate there is no unnecessary code put in the applicationDidFinish method (should be empty if you didn't put a custom code in it)
    • Check if your view controller contains -(void)loadView and delete the method to avoid a black screen on startup

    Hope it helps.