[英]UIButton with Animation Image doesn't showing
I have found posts that concern with UIButton with Animation Image. 我发现了有关带有动画图像的UIButton的帖子。 However i didn't found any solutions. 但是我没有找到任何解决方案。
Here is my code. 这是我的代码。
UIImage *imageOne=[UIImage imageNamed:@"1Ads.png"];
UIImage *imageTwo=[UIImage imageNamed:@"2Ads.png"];
UIImage *imageThree=[UIImage imageNamed:@"3Ads.png"];
NSArray *arr = [[NSArray alloc] initWithObjects:imageOne,imageTwo,imageThree, nil];
self.btnAds.imageView.animationDuration = 7.0;
self.btnAds.imageView.animationImages = arr;
[self.btnAds.imageView startAnimating];
It's doesn't showing anything in View. 它没有在View中显示任何内容。
How can i do it? 我该怎么做?
Use the imageView property of UIButton. 使用UIButton的imageView属性。 You can create an animation like this: 您可以像这样创建动画:
[myButton setImage:[UIImage imageNamed:@"1.png"] forState:UIControlStateNormal];
myButton.imageView.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:@"1.png"],
[UIImage imageNamed:@"2.png"],
[UIImage imageNamed:@"3.png"],
[UIImage imageNamed:@"4.png"],
[UIImage imageNamed:@"5.png"],
nil];
myButton.imageView.animationDuration = 0.5;
[myButton.imageView startAnimating];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.