// Animate the sprited view. [_animationView startAnimatingWithCompletion:^{ // When animation completes, toggle image. _toggle = !_toggle; UIImage *spriteImage = [UIImage imageNamed:_toggle ? kSpriteGridImage : kSpriteListImage]; _animationView.spriteSheetImage = spriteImage; }];
Integrating the spritedAnimationView
is somewhat similar to adding an UIImageView
to a view.
#import "GOSSpritedAnimationView.h" // Create a Sprited Animation View. UIImage *spriteSheet = [UIImage imageNamed:@"myImage"]; GOSSpritedAnimationView *animationView = [[GOSSpritedAnimationView alloc] initWithSpriteSheetImage:spriteSheet]; animationView.tintColor = [UIColor blueColor]; [self.view addSubview:animationView]; // To Animate. [animationView startAnimatingWithCompletion:^{ NSLog(@"Done animating."); }];