mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
ui/app: fix display link on iOS 10
For some reason, the CADisplayLink.paused property didn't work on iOS 10 but does on iOS 12. Use addToRunLoop and removeFromRunLoop instead. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+6
-4
@@ -129,9 +129,6 @@ NSArray<UIKeyCommand *> *_keyCommands;
|
||||
if (self) {
|
||||
__weak id weakSelf = self;
|
||||
displayLink = [CADisplayLink displayLinkWithTarget:weakSelf selector:@selector(onFrameCallback:)];
|
||||
displayLink.paused = YES;
|
||||
NSRunLoop *runLoop = [NSRunLoop currentRunLoop];
|
||||
[displayLink addToRunLoop:runLoop forMode:[runLoop currentMode]];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -141,7 +138,12 @@ NSArray<UIKeyCommand *> *_keyCommands;
|
||||
}
|
||||
|
||||
- (void)setAnimating:(BOOL)anim {
|
||||
displayLink.paused = !anim;
|
||||
NSRunLoop *runLoop = [NSRunLoop currentRunLoop];
|
||||
if (anim) {
|
||||
[displayLink addToRunLoop:runLoop forMode:[runLoop currentMode]];
|
||||
} else {
|
||||
[displayLink removeFromRunLoop:runLoop forMode:[runLoop currentMode]];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
|
||||
|
||||
Reference in New Issue
Block a user