【问题标题】:How to stop my animated button from looping constantly?如何阻止我的动画按钮不断循环?
【发布时间】:2015-08-26 09:53:34
【问题描述】:

我刚开始尝试在我的 IOS 开发中使用动画,当我点击一个按钮时我已经设法让动画工作了 - 但是它会在一个恒定循环中重复! 如何阻止我的动画在通过我的 .png 序列后重复?

[measureButton.imageView setAnimationImages:images];
[measureButton.imageView setAnimationDuration:0.75];
[measureButton.imageView startAnimating];

【问题讨论】:

标签: ios objective-c animation uibutton


【解决方案1】:

您可以使用属性animationRepeatCount

[measureButton.imageView setAnimationRepeatCount:1];//The animation will repeat only once

此属性(animationRepeatCount)的默认值为 0,表示图像是无限动画的。

【讨论】:

    【解决方案2】:

    当您到达最后一张图片时,您可以在您的 imageView 上调用 stopAnimating。

    【讨论】:

      【解决方案3】:

      [measureButton.imageView stopAnimating]; 希望对你有所帮助...

      【讨论】:

        猜你喜欢
        • 2013-03-16
        • 2020-11-27
        • 1970-01-01
        • 2018-05-03
        • 2017-06-07
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多