I create a GLKViewController like this:
// Create a GLK View Controller to handle animation timings
_glkVC = [[GLKViewController alloc] initWithNibName:nil bundle:nil];
_glkVC.preferredFramesPerSecond = 60;
_glkVC.view = self.glkView;
_glkVC.delegate = self;
_glkVC.paused = YES;
NSLog(@"initial state: %@", _glkVC.paused ? @"paused" : @"running");
but it immediately starts calling the delegate update method and the output from the NSLog above is: initial state: running
I am managing my view updates with setNeedsDisplay but I want the GLKViewController to handle animations from time to time so I want to unpause it only when needed. Is there a way to start the controller in a paused state?
In lieu of any answers I’m using this work-around:
I set
.preferredFramesPerSecond = 1initially and then in the update method I checkif(preferredFramesPerSecond == 1)and set.paused = YES(and also set my real desired value forpreferredFramesPerSecond). I can then allow the rest of the update method to run once after initialisation, or return immediately if I don’t want it to run yet.I then trigger redraws manually as needed with
setNeedsDisplayand unpause it when I need it to animate.If anyone has a better solution please answer as usual.