Skip to content

cell复用时视频封面图显示错乱 #3

@BackWorld

Description

@BackWorld

解决:

var moviePath : String?{
        didSet{
            if let iPath = moviePath {
                moviePlayer.contentURL = NSURL(fileURLWithPath: iPath, isDirectory: false)
                moviePlayer.prepareToPlay()
                // 移除上次复用的cell的image,防止显示错乱
                imageView.removeFromSuperview()
                // 再重新add上更换完图片的当前cell对应的image
                moviePlayer.view.addSubview(imageView)
            }
        }
    }

func playerDisplayChange()
    {
        // 准备播放时[预览图加载出来时] 移除封面image
        if moviePlayer.readyForDisplay {
            imageView.removeFromSuperview()
        }
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions