gpt4 book ai didi

iOS swift : Crash on deleteRowsAtIndexPaths

转载 作者:搜寻专家 更新时间:2023-10-31 08:23:47 25 4
gpt4 key购买 nike

<分区>

当我从 tableView 中删除一行时发生崩溃。不确定发生了什么。这是我的代码:

func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
let items = days[indexPath.row]
self.removeItems(items, indexPath: indexPath)
}

func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return days.count
}

移除元素

func removeItems(items: [CKRecord], indexPath: NSIndexPath) {

for item in items {
db.deleteRecordWithID(item.recordID) { (record, error) -> Void in
if error != nil {
println(error.localizedDescription)
}

dispatch_async(dispatch_get_main_queue()) { () -> Void in
if let index = find(exercises, item) {
exercises.removeAtIndex(index)
}
}
}
}

days.removeAtIndex(indexPath.row)
tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Automatic)
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com