图像动画不起作用

时间:2015-08-14 05:19:55

标签: ios objective-c uiimageview

我希望在0.7秒后制作动画图片,但是他们不工作,他们不会在我的视图上显示图像。

NSMutableArray *images = [[NSMutableArray alloc] init];
[images addObject:[UIImage imageNamed:@"L1.png"]];
[images addObject:[UIImage imageNamed:@"L2.png"]];
[images addObject:[UIImage imageNamed:@"L3.png"]];
[images addObject:[UIImage imageNamed:@"L4.png"]];
[images addObject:[UIImage imageNamed:@"L5.png"]];
[images addObject:[UIImage imageNamed:@"L6.png"]];
[images addObject:[UIImage imageNamed:@"L7.png"]];
[images addObject:[UIImage imageNamed:@"L8.png"]];
[images addObject:[UIImage imageNamed:@"L9.png"]];
[images addObject:[UIImage imageNamed:@"L10.png"]];
[images addObject:[UIImage imageNamed:@"L11.png"]];
[images addObject:[UIImage imageNamed:@"L12.png"]];
self.imagsd.animationImages=images;
self.imagsd.animationDuration=0.7;

2 个答案:

答案 0 :(得分:1)

您需要在图片视图上调用startAnimating

答案 1 :(得分:0)

// Load images



 NSMutableArray *images = [[NSMutableArray alloc] init];
[images addObject:[UIImage imageNamed:@"L1.png"]];
[images addObject:[UIImage imageNamed:@"L2.png"]];
[images addObject:[UIImage imageNamed:@"L3.png"]];
[images addObject:[UIImage imageNamed:@"L4.png"]];
[images addObject:[UIImage imageNamed:@"L5.png"]];
[images addObject:[UIImage imageNamed:@"L6.png"]];
[images addObject:[UIImage imageNamed:@"L7.png"]];
[images addObject:[UIImage imageNamed:@"L8.png"]];
[images addObject:[UIImage imageNamed:@"L9.png"]];
[images addObject:[UIImage imageNamed:@"L10.png"]];
[images addObject:[UIImage imageNamed:@"L11.png"]];
[images addObject:[UIImage imageNamed:@"L12.png"]];

// Normal Animation
UIImageView *animationImageView = [[UIImageView alloc] initWithFrame:CGRectMake(60, 95, 86, 193)];
animationImageView.animationImages = images;
animationImageView.animationDuration = 0.5;

[self.view addSubview:animationImageView];
[animationImageView startAnimating];