请如何在TableView中滑动以删除消息?
Firebase中的数据
var sectionsArray = [NSDictionary?]()
代码super.viewDidLoad()
databaseRef.child("Sections").queryOrdered(byChild: "name").observe(.childAdded, with: { (snapshot) in
var key = snapshot.key
let snapshot = snapshot.value as? NSDictionary
snapshot?.setValue(key, forKey: key)
self. sectionsArray.append(snapshot)
self.TableView.insertRows(at: [IndexPath(row:self. sectionsArray.count-1,section:0)], with: UITableViewRowAnimation.automatic)
}
}
代码删除
override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
if editingStyle == .delete {
// I want this code...
}
}