Что можно сделать, это сбросить все изображения при настройке ячейки.Поскольку tableView
повторно использует ячейки, некоторые свойства сохраняются как в последний раз, когда они изменялись.Если это проблема, код может быть исправлен как:
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "PlayerCell", for: indexPath) as! PlayerCell
cell.txtLabel.text = menuArray[indexPath.item]
cell.play_pauseButton.tag = indexPath.row
if player?.isPlaying == true && indexPath.row == previous { //Sets the "media-pause" image to the currently played cell
cell.play_pauseButton.setImage(UIImage(named: "media-pause"), for: .normal)
} else { //Every other cell that is not the playing one is reseted to the "play-button" image
cell.play_pauseButton.setImage(UIImage(named: "play-button"), for: .normal)
}
return cell
}