3

I'm adding new view controllers (scenes) via the interface builder. I drop them on the canvas and then create a new view controller subclass (NewViewController, this creates two fiels: NewViewController.h and NewViewController.m). I then set the "class" under the identity inspector to the newly added view controller (NewViewController).

Now when I run the app the initial scene has a button with a segue to the second scene (where NewViewController is the "class") and it doesn't load the new scene/view, its just black. Am I missing a step?

If I remove the class: NewViewController, and put it back to the initial view controller (ViewController) it displays the page just fine.

I'm following this guide

Neysor
  • 3,893
  • 11
  • 34
  • 66
Bam
  • 33
  • 3

2 Answers2

4

Remove the loadView method that Xcode adds for you in the view controller. This method is required when you build you views programatially but is not needed when using XIBs or Storyboards.

Stephen Darlington
  • 51,577
  • 12
  • 107
  • 152
  • Wow, I new it would be something simple. Event though it is an empty method it was still hosing the view. I just removed the -(void)loadView stubs and it works.Thanks Stephen. – Bam Mar 01 '12 at 14:47
  • 1
    This also happens when you name a property loadView. Whoops! =P – valheru Jan 08 '13 at 19:09
0

Did you control drag from the button of the first scene to the second scene to set up the segue between the two scenes? do you have something happening when you click on the button?

tiguero
  • 11,477
  • 5
  • 43
  • 61
  • I believe u did something wrong in you new viewcontroller - did u make sure it is a subclass of UIViewController when you set up that class? – tiguero Mar 01 '12 at 14:46
  • yeah, I set up the segue and it was navigating to the second page but didn't look like it was loading anything (hense just being black). I removed the -(void)viewLoad stub method from the new view controllers ".m"s and it fired right up. – Bam Mar 01 '12 at 14:49