https://www.jianshu.com/p/cb437c3f3f58
ios动画进入后台停止
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appDidEnterPlayground) name:UIApplicationDidBecomeActiveNotification object:nil];
}
-(void)appDidEnterPlayground{
[self.heroBtn.layer removeAllAnimations];
[self.heroBtn.layer addAnimation:[self groupAnimation] forKey:nil];
}
image的动画属性
UIImage *image1 = [UIImage imageNamed:@"101"];
UIImage *image2 = [UIImage imageNamed:@"102"];
UIImage *image3 = [UIImage imageNamed:@"103"];
UIImage *image4 = [UIImage imageNamed:@"104"];
UIImage *image5 = [UIImage imageNamed:@"105"];
UIImage *image6 = [UIImage imageNamed:@"106"];
UIImage *image7 = [UIImage imageNamed:@"107"];
UIImage *image8 = [UIImage imageNamed:@"108"];
NSArray *images = [NSArray arrayWithObjects:image1,image2,image3,image4,image5,image6,image7,image8, nil];
//UIImageView *imageView = [[UIImageView alloc] initWithImage:image1];
// imageView.frame = CGRectMake(320/2-117/2, 150, 117, 120);
_animationImag.animationImages = images;
// 设置动画数组
_animationImag.animationDuration = 0.6f;
// 动画播放时间
[_animationImag startAnimating];
// 开始动画
//[self.view addsubviw animationimage];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
//停止
[_animationImag stopAnimating];
});
网友评论