我想点击基于ID的行
所以我声明了一个数组来存储ID:
var idenArr = [String]()
在didSelectRowAt indexPath:
上func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
var cell = tableView.dequeueReusableCell(withIdentifier: "myOrderTableViewCell", for: indexPath as IndexPath) as! MyOrderTableViewCell
cell = idenArr[indexPath.row] `<-- Here show me this error "Cannot assign value of type 'String' to type 'MyOrderTableViewCell'"`
}
答案 0 :(得分:0)
为此,您可以通过以下方式获取:
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let ID = idenArr[indexPath.row]
print("Your selected Id is:" ID)
}