小编Исм*_*тов的帖子

如何检查表视图单元格焦点和播放器设置暂停

在此输入图像描述

我的项目

我连续几张桌子上有几个视频.

问题是它们是同步播放的.在屏幕上1video,并2video播放同步

如何在桌面视图上跟踪焦点单元格cell.player?.play().和其他细胞cell.player?.pause()

我的代码:

   class MyViewController
//don't work
func tableView(_ tableView: UITableView, didEndDisplaying cell: UITableViewCell, forRowAt indexPath: IndexPath) {
    if let cell = tableView.cellForRow(at: indexPath) as? ListViewCell {
        cell.player?.pause()
    }
}


//don't call
func tableView(_ tableView: UITableView, didUpdateFocusIn context: UITableViewFocusUpdateContext, with coordinator: UIFocusAnimationCoordinator) {
    print("table view cell didUpdateFocusIn")
}




class MyTableviewCell

override func prepareForReuse() {
        super.prepareForReuse()
        player?.pause()
    }
Run Code Online (Sandbox Code Playgroud)

ios swift

8
推荐指数
1
解决办法
662
查看次数

标签 统计

ios ×1

swift ×1