I have an OpenGLES app, with a CADisplayLink (added in NSRunLoopCommonModes) that I use to call the main loop (where I do all the OpenGL calls).
I added a UIScrollView, but it randomly get stuck. If I send the app to the background, when I get back sometimes it works perfectly, while others it's stuck (I can sort of move it around, but it doesn't slide when you let go).
Tracking down the problem, I noticed the UIScrollView's internal funcion _smoothScrollWithUpdateTime: is not being called. Apparently it uses is own CADisplayLink to get that call. So I tried adding my own CADisplayLink (separate from the main one that does all the drawing), and it's also randomly not being called. Here is the code:
- (void) addDisplayLink
{
displayLink = [NSClassFromString(@"CADisplayLink") displayLinkWithTarget:self selector:@selector(loop:)];
[displayLink setFrameInterval:1];
[displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSRunLoopCommonModes];
}
- (void) loop:(id)sender
{
NSLog(@"Loop working!");
}
Any ideas?
TL/DR: I have two CADisplayLinks and one of them is not working.