当用户触摸屏幕时,uiimageview动画停止 [英] uiimageview animation stops when user touches screen

查看:724
本文介绍了当用户触摸屏幕时,uiimageview动画停止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有动画图像的UImageview。
i我在代码中添加了uiimageview,它是CollectionViewCell的一部分
当用户触摸单元格动画停止时,为什么会发生这种情况?

I have a UImageview with animated image. i am adding the uiimageview in code and its a part of a CollectionViewCell When the user touches the cell the animation stops, why does this happen?

代码:

 var images: [UIImage] = []
for i in 0...10 {
   images.append(UIImage(named: "image\(i)"))
}

        let i = UIImageView(frame: CGRect(x: xPos, y: yPos, width: 200, height: 200))
        i.animationImages = images
        i.animationDuration = 0.5
        i.startAnimating()
        i.contentMode = UIViewContentMode.Center
        i.userInteractionEnabled = false

        self.addSubview(i) 


推荐答案

Swift 4.0版本:

Swift 4.0 Version:

override open var isSelected: Bool
{
    set {

    }

    get {
        return super.isSelected
    }
}

override open var isHighlighted: Bool
{
    set {

    }

    get {
        return super.isHighlighted
    }
}

这篇关于当用户触摸屏幕时,uiimageview动画停止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆