UIImage动画图像数组 [英] UIImage animating an array of images
本文介绍了UIImage动画图像数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
- (IBAction)didTouchAnimate:(UIButton*)sender {
UIImage *starImage = [UIImage imageNamed:@"star.png"];
UIImageView *starView = [[UIImageView alloc] initWithImage:starImage];
[starView setCenter:sender.center];
[UIView animateWithDuration:1.50f delay:0.0f options:UIViewAnimationCurveEaseInOutanimations:^{
[starView setCenter:CGPointMake(+100, +100)];
[starView setAlpha:0.6f];
}
completion:^(BOOL finished){
[starView removeFromSuperview];
// points++;
// NSLog(@"points: %i", points);
}];
[self.view addSubview:starView];
}
我有一个数组列表。如何为这些图像制作动画。
I have an array list. How can I animate these images.
Dollars.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:@"score_animate_0001.png"],
[UIImage imageNamed:@"score_animate_0002.png"],
[UIImage imageNamed:@"score_animate_0003.png"],
[UIImage imageNamed:@"score_animate_0004.png"],
[UIImage imageNamed:@"score_animate_0005.png"],
[UIImage imageNamed:@"score_animate_0006.png"],
[UIImage imageNamed:@"score_animate_0007.png"],nil];
推荐答案
本教程将为您提供帮助...
This tutorial will help you...
否则,请在您的 didTouchAnimate
方法中执行此操作
Else, do this inside your didTouchAnimate
method
UIImageView * animatedImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 200,200)];
testArray = [[NSArray alloc] initWithObjects:[UIImage imageNamed:@"test_001.png"], [UIImage imageNamed:@"test_002.png"],[UIImage imageNamed:@"test_001.png"],nil];
animTime =3.0;
[animatedImageView setAnimationImages:testArray] ;
animatedImageView.animationDuration = animTime;
animatedImageView.animationRepeatCount = 1;
[self.view addSubview: animatedImageView];
[animatedImageView startAnimating];
这篇关于UIImage动画图像数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文