diff --git a/OLImageView.m b/OLImageView.m index 4217b1b..eeef56b 100644 --- a/OLImageView.m +++ b/OLImageView.m @@ -216,6 +216,12 @@ - (void)displayLayer:(CALayer *)layer layer.contents = (__bridge id)([[self.animatedImage.images objectAtIndex:self.currentFrameIndex] CGImage]); } +- (void)setBackgroundColor:(UIColor *)backgroundColor +{ + [super setBackgroundColor:backgroundColor]; + self.layer.backgroundColor = [backgroundColor CGColor]; +} + - (void)didMoveToWindow { [super didMoveToWindow]; diff --git a/OLImageViewDemo/Images/google-io.gif b/OLImageViewDemo/Images/google-io.gif index 7afbd30..da141cc 100644 Binary files a/OLImageViewDemo/Images/google-io.gif and b/OLImageViewDemo/Images/google-io.gif differ diff --git a/OLImageViewDemo/Images/google-io@2x.gif b/OLImageViewDemo/Images/google-io@2x.gif index e23ba19..3b6360c 100644 Binary files a/OLImageViewDemo/Images/google-io@2x.gif and b/OLImageViewDemo/Images/google-io@2x.gif differ diff --git a/OLImageViewDemo/Images/google-io@3x.gif b/OLImageViewDemo/Images/google-io@3x.gif index 1686c70..cd9d751 100644 Binary files a/OLImageViewDemo/Images/google-io@3x.gif and b/OLImageViewDemo/Images/google-io@3x.gif differ diff --git a/OLImageViewDemo/OLAppDelegate.m b/OLImageViewDemo/OLAppDelegate.m index dbf544e..a9e4e64 100644 --- a/OLImageViewDemo/OLAppDelegate.m +++ b/OLImageViewDemo/OLAppDelegate.m @@ -50,6 +50,9 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( [magicAnimatedVC.view addSubview:Aimv]; Aimv = [[OLImageView alloc] initWithImage:[OLImage imageNamed:@"google-io"]]; + Aimv.contentMode = UIViewContentModeCenter; + Aimv.clipsToBounds = YES; + Aimv.backgroundColor = [UIColor cyanColor]; [Aimv setFrame:CGRectMake(0, 160, 160, 160)]; [Aimv setUserInteractionEnabled:YES]; [Aimv addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap:)]]; @@ -115,6 +118,8 @@ - (void)handleTap:(UITapGestureRecognizer *)gestRecon NSLog(@"STOP"); [imageView stopAnimating]; } else { + CGFloat randomHue = (CGFloat)arc4random_uniform(255) / 255; + imageView.backgroundColor = [UIColor colorWithHue:randomHue saturation:1 brightness:1 alpha:1]; self.running = YES; NSLog(@"START"); [imageView startAnimating];