Skip to content

Instantly share code, notes, and snippets.

@jamztang
Created April 16, 2014 14:41
Show Gist options
  • Save jamztang/10886837 to your computer and use it in GitHub Desktop.
Save jamztang/10886837 to your computer and use it in GitHub Desktop.
Use Canvas to loop animation forever (hacky way)
#import <UIKit/UIKit.h>
#import "CSAnimation.h"
#import "CSAnimationView.h"
@interface CSLoopingAnimationView : CSAnimationView
@end
#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