【发布时间】:2017-01-28 02:36:20
【问题描述】:
我正在使用animationImages 为UIButton 制作动画,并且动画成功,但动画完成后UIButton 会自动淡出。如何避免淡出?
sender.imageView.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:[NSString stringWithFormat:@"main_bird_animation_01%@",ipadVar]],
[UIImage imageNamed:[NSString stringWithFormat:@"main_bird_animation_02%@",ipadVar]],
[UIImage imageNamed:[NSString stringWithFormat:@"main_bird_animation_03%@",ipadVar]],
nil];
sender.imageView.animationDuration = 1.f;
sender.imageView.animationRepeatCount = 4.f;
[sender.imageView startAnimating];
【问题讨论】:
-
这是在 IBAction 方法中发生的吗?
-
是的,它发生在 IBAction 方法中
-
动画完成后,是否可以尝试重置图像状态?完成处理程序参考this链接
-
我已经读过这个,但这不是正确的方法,我想找出它为什么会这样
-
您在添加动画图像之前是否已经设置了按钮图像?
[button setImage:image forState:UIControlStateNormal];
标签: ios objective-c animation uibutton