Created
April 16, 2014 14:41
-
-
Save jamztang/10886837 to your computer and use it in GitHub Desktop.
Use Canvas to loop animation forever (hacky way)
This file contains 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
#import <UIKit/UIKit.h> | |
#import "CSAnimation.h" | |
#import "CSAnimationView.h" | |
@interface CSLoopingAnimationView : CSAnimationView | |
@end |
This file contains 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
#import "CSLoopingAnimationView.h" | |
@implementation CSLoopingAnimationView | |
- (void)startCanvasAnimation { | |
[super startCanvasAnimation]; | |
[NSObject cancelPreviousPerformRequestsWithTarget:self | |
selector:@selector(startCanvasAnimation) | |
object:nil]; | |
[self performSelector:@selector(startCanvasAnimation) | |
withObject:nil | |
afterDelay:self.duration]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment