【发布时间】:2017-06-07 03:28:42
【问题描述】:
我在 swift 3 的 tvOS 项目中为我的 tableview 提供了此代码,我希望滚动时颜色单元格不聚焦!请你解释一下是怎么做的?
这是我的代码
func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return tvChannelsArray.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath)
// Show TV Channels names
cell.textLabel?.text = ((tvChannelsArray[(indexPath as NSIndexPath).row] as AnyObject).object(forKey: "channel") as! String)
cell.imageView?.image = UIImage(named: "\(cell.textLabel!.text!)")
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
channelsTableView.isHidden = false;
return 100
}
【问题讨论】:
标签: swift xcode uitableview cell