Cells in table view not responding

后端 未结 1 1235
我寻月下人不归
我寻月下人不归 2021-01-25 07:06

I am working on a todo list app and whenever I run it on the simulator and try to print the items in my array, the other cells item get printed.

<
相关标签:
1条回答
  • 2021-01-25 07:23

    You need didSelectRowAt not didDeselectRowAt , the latter is triggered when you select a row so you get the print from the previous selected row

    override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        print(itemArray[indexPath.row])
    }
    
    0 讨论(0)
提交回复
热议问题