UITableView
checkmark
发生的是取消选择当我滚动UITableView的滚动型与取消的问题
代码
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int
{
return dizi.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
{
let cell = UITableViewCell(style: UITableViewCellStyle.default, reuseIdentifier: "cell")
cell.textLabel?.text=dizi[indexPath.row]
return cell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)
{
if tableView.cellForRow(at: indexPath)?.accessoryType == UITableViewCellAccessoryType.checkmark
{
tableView.cellForRow(at: indexPath)?.accessoryType = UITableViewCellAccessoryType.none
}
else
{
tableView.cellForRow(at: indexPath)?.accessoryType = UITableViewCellAccessoryType.checkmark
}
}
我怎样才能解决这个问题?请帮帮我。
非常感谢你解决 – Tiskender2
@ tiskender2:随时欢迎好友:)我很高兴我能有帮助:)快乐的编码 –