【发布时间】:2019-05-29 11:39:06
【问题描述】:
当我第一次切换到有延迟时,我有一个带有自定义单元格的tableView,在搜索问题后,我发现显示照片是我寻找问题的原因,但没有任何帮助。我试图在主队列中进行转换
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as? TVCellMenu else { return UITableViewCell()}
let data = category[indexPath.row]
cell.title.text = data.name
//image is reason
let image = UIImage(named: data.image_name ?? "", in: Bundle.main, compatibleWith: nil)
cell.ImageView.image = image
return cell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let storyBoard = UIStoryboard(name: "Main", bundle: nil)
let vc = storyBoard.instantiateViewController(withIdentifier: "menu") as! VCMenu
vc.isCategory = false
vc.subCategory = self.category[indexPath.row].subCategory
vc.position = self.category[indexPath.row].position
navigationController?.pushViewController(vc, animated: true)
}
【问题讨论】:
-
主队列中的哪个转换?在 didSelectRowAt 中?
-
@Sh_Khan 在 didSelectRowAt 中是的
标签: swift image uitableview tableview