Swift 在uitable中滚动单元格时更改焦点和颜色

Swift 在uitable中滚动单元格时更改焦点和颜色,swift,xcode,uitableview,cell,Swift,Xcode,Uitableview,Cell,我在swift 3的tvOS项目中为我的tableview提供了这段代码,我希望滚动时的颜色单元格不是焦点!你能解释一下怎么做吗 这是我的密码 func numberOfSections(在tableView:UITableView中)->Int{ 返回1 } func tableView(tableView:UITableView,numberofrowsinssection:Int)->Int{ 返回tvChannelsArray.count } func tableView(tableV

我在swift 3的tvOS项目中为我的tableview提供了这段代码,我希望滚动时的颜色单元格不是焦点!你能解释一下怎么做吗

这是我的密码

func numberOfSections(在tableView:UITableView中)->Int{
返回1
}
func tableView(tableView:UITableView,numberofrowsinssection:Int)->Int{
返回tvChannelsArray.count
}
func tableView(tableView:UITableView,cellForRowAt indexath:indexPath)->UITableViewCell{
let cell=tableView.dequeueReusableCell(带有标识符:“cell”,用于:indexath)
//显示电视频道名称
cell.textLabel?.text=((tvChannelsArray[(indexPath作为NSIndexPath.row]作为任何对象)。对象(forKey:“channel”)作为!字符串)
cell.imageView?.image=UIImage(名为:“\(cell.textlab!.text!)”)
返回单元
}
func tableView(tableView:UITableView,heightForRowAt indexath:indexPath)->CGFloat{
channelsTableView.ishiden=false;
返回100

}
在tableview委托中实现UISsrollViewDelegate方法


tableView说找不到怎么改呢?
    func scrollViewDidScroll(_ scrollView: UIScrollView) {
        for cell in tableView.visibleCells {
            if let currentCellPath = tableView.indexPath(for: cell),
               let selectedCellPath = tableView.indexPathForSelectedRow {
                guard currentCellPath != selectedCellPath else {
                    continue
                }
            }
            let red = Float(cell.frame.origin.y / scrollView.contentSize.height)
            cell.contentView.backgroundColor = UIColor(colorLiteralRed: red, green: 0.5, blue: 0.25, alpha: 1)
        }
    }