【发布时间】:2018-03-01 12:13:58
【问题描述】:
我在 tableView 中为 reloadCell 添加了一个按钮,我想在按下按钮时删除特定单元格上的数组元素,但我收到此错误
上下文类型 'Int' 不能与数组字面量一起使用
@IBAction func reloadCell(_ sender: UIButton) {
let index = IndexPath(row: sender.tag, section: 0)
sortedArray.remove(at: [index]) //HERE I GET THE ERROR
self.tableView.reloadRows(at: [index], with: .right)
}
我该如何解决?
【问题讨论】:
-
sortedArray.remove(at: sender.tag)
-
你需要整数而不是 IndexPath 类
标签: ios arrays swift uitableview swift4