您好,需要一些有关索引路径的帮助我想在单击行项目时将行详细信息发送到另一个视图控制器。单击该行后,我没有得到适当的详细信息,而是在控制台中显示了其他索引的详细信息。我正在从JSon获取数据。任何帮助将不胜感激...
didselectrow at function image
函数行的单元格
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as! StationCell
cell.citylabel.text = city[indexPath.row]
cell.loclabel.text = loc[indexPath.row]
let change = status[indexPath.row]
cell.loclabel.numberOfLines = 0
cell.statuslabel.text = change
if cell.statuslabel.text == "Available"{
cell.statuslabel.textColor = UIColor.green
}
else{
cell.statuslabel.textColor = UIColor.red
}
cell.personname.text = persondata[indexPath.row]
cell.contactnumber.text = contactdata[indexPath.row]
//cell.statuslabel.textColor = UIColor.green
//cell.loclabel.numberOfLines = 0
areaidvalue = areaid[indexPath.row]
stationidvalue = stationid[indexPath.row]
return cell
}
在DidSelectRowAtIndexPath中编写以下代码以在选定索引处获取站代码
areaidvalue = areaid [indexPath.row]
stationidvalue = stationid [indexPath.row]