Created
August 16, 2010 14:39
-
-
Save sarnesjo/527043 to your computer and use it in GitHub Desktop.
using CADisplayLink
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)startAnimating | |
{ | |
if(self.displayLink) | |
return; | |
self.displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(tick:)]; | |
[self.displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; | |
} | |
- (void)stopAnimating | |
{ | |
[self.displayLink invalidate]; | |
self.displayLink = nil; | |
} | |
- (void)tick:(CADisplayLink *)displayLink | |
{ | |
} | |
- (void)dealloc | |
{ | |
[self stopAnimating]; | |
[super dealloc]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment