0

I am trying to have a different view controller appear as you change the device orientation and for that I am using a UINavigation Controller. When I call for the other view controller to be pushed [self.navigationController pushViewController:graphView animated:YES]; It makes the transition but the screen is black and does not load this new controller "graphView"'s view which is white with text. I have done graphView = [[GraphView alloc] init]; for the new controller but i do not have any storyboard connections made from the current view to the graph view nor do I have anything in my new view controller other than:

- (void)viewDidLoad {
    //[super viewDidLoad];

    NSLog(@"loaded");
}

Is there an extra step since this is a new view controller to load the view from this view controller that i have on my storyboard? Also the log does work meaning that is corrent.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Grant Wilkinson
  • 1,088
  • 1
  • 13
  • 38
  • This answer worked for me http://stackoverflow.com/questions/12130981/push-view-controller-not-showing-elements-added-from-storyboard?rq=1 – Grant Wilkinson Jul 28 '13 at 21:01

1 Answers1

0

Instead of initializing your 'graphView' like:

graphView = [[GraphView alloc] init];

You'll need to do this:

UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
graphView = [storyboard instantiateViewControllerWithIdentifier:@"YourViewControllerId"];

**And make sure you set your ViewController's storyboard identifier in the storyboard:

  1. Select your ViewController
  2. Click the Identity inspector
  3. Set the Storyboard ID ('YourViewControllerId' above)

Then, calling pushViewController:animated: as you were should present your ViewController appropriately.

hgwhittle
  • 9,316
  • 6
  • 48
  • 60