Add and remove observer from multiple AVPlayerItem on UITableViewCell

后端 未结 2 1467
醉酒成梦
醉酒成梦 2021-01-16 02:33

i am trying to make a table view that plays multiple videos with AVPlayer and AVPlayerItem and i needed to addObserver to each AVPlayerItem

2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-16 02:55

    Try to override 'prepareForReuse' function in your UITableViewCell subclass, and remove observer in that place.

    override func prepareForReuse() {
        super.prepareForReuse()
    
        //remove observer here...
    }
    

提交回复
热议问题