当我每次向左滑动以删除我的应用程序崩溃时运行我的应用程序时它指向线程1:信号 # When the Random object's seed is different, multiple runs result in different outcome:
pry(main)> [1,2,3,4,5,6,7].shuffle(random: Random.new)
=> [5, 6, 3, 4, 1, 7, 2]
pry(main)> [1,2,3,4,5,6,7].shuffle(random: Random.new)
=> [1, 7, 6, 4, 5, 3, 2]
# When the Random object is created with the same seed, multiple runs return the same result:
pry(main)> [1,2,3,4,5,6,7].shuffle(random: Random.new(1))
=> [7, 3, 2, 1, 5, 4, 6]
pry(main)> [1,2,3,4,5,6,7].shuffle(random: Random.new(1))
=> [7, 3, 2, 1, 5, 4, 6]
“我相信这是我的代码的一部分这是造成它的。
SIGABRT
答案 0 :(得分:0)
您可以像这样修改代码:
override func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
if editingStyle == .Delete {
allItems[indexPath.section].removeAtIndex(indexPath.row)
tableView.reloadData()
} else if editingStyle == .Insert {
let newData = DataItem(title: "New Data", subtitle: "", imageName: nil)
allItems[indexPath.section].append(newData)
tableView.reloadData()
}
}