【问题标题】:Animate UIButton with animationImages changes button state fade after animation completion使用 animationImages 为 UIButton 设置动画在动画完成后更改按钮状态淡入淡出
【发布时间】: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


【解决方案1】:

我得到了解决方案,实际上有一个与UIButton 关联的属性称为Disabled Adjust Image,我只是取消选中它就成功了。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-04-10
    • 2014-05-30
    • 2014-01-20
    • 2012-12-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多