0
点击时,AlertController可以在表视图的每个单元中正常工作。在警报中按下“OK”后,当我再次点击同一个单元格时,它会发出sigabrt错误。不知道该做什么。以下是代码:如果表视图中的某个单元再次点击,则UIAlertController会发出sigabrt错误
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as! JobsTableViewCell
cell.jobTitle.text = jobTitle[indexPath.row]
cell.jobDescription.text = jobDetail[indexPath.row]
return cell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as! JobsTableViewCell
cell.jobTitle.text = jobTitle[indexPath.row]
cell.jobDescription.text = jobDetail[indexPath.row]
displayMessage(titleAlert: jobTitle[indexPath.row], userMessage: jobDetail[indexPath.row])
}
这哪里是JOBTITLE全局变量来自哪里?为什么它是全球性的? – Msencenb
@Minnb这是这个类的变量,值添加到它ViewDidLoad() –