0

I´m using a simple GLKViewController within Storyboard, which is working fine.

As I want its view to show up in front of another view, to place openGL objects above this other view, I instantiate the GLKViewController programmatically within a second VC and add the GLKViewController´s view as subview:

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle: nil]; 
AROpenGLVC *openGlVC = [storyboard instantiateViewControllerWithIdentifier:@"objects OpenGL Controller"];
[self.view addSubview:openGlVC.view];

Unfortunately, the result is a black view without my animated openGL objects.

I ran the debugger a it seems to go through all initializations aso.

- (void)glkView:(GLKView *)view drawInRect:(CGRect)rectis called also,

but the - (void)updatemethod isn´t.

Must be something obvious, but I can´t see why though.

Cœur
  • 37,241
  • 25
  • 195
  • 267
shallowThought
  • 19,212
  • 9
  • 65
  • 112

2 Answers2

1

Try This:

-(IBAction)nextView{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard"   
bundle:nil];
AROpenGLVC * nextView = (AROpenGLVC *) [storyboard 
instantiateViewControllerWithIdentifier:@"detailView"];
[self presentViewController:detailView animated:YES completion:nil];
}

//On the 4th line where it says ...WithIdentifier:@"detailView"];, go into your storyboard, and click the view controller (yellow box) and click on the tab where you choose what class the viewController belongs to (identity inspector).

on the right, name the storyboard the same as in between the "" . then hook up the method to a button, and it should switch views for you!

P.s. make sure you have the same story board name as specified! :D

IF YOU WANT TO PRESENT THE VIEW AUTOMATICALLY, MAKE SURE YOU HAVE NAMED THE VIEWCONTROLLER CORRECTLY!

Bad_APPZ
  • 432
  • 1
  • 3
  • 12
0

Have you retain AROpenGLVC in the root view controller?

Oscar
  • 651
  • 5
  • 13