整个上午,我在阅读文档,观看教程和搜索后一直在努力。有什么新鲜的眼睛可以发现我在此扩展程序中做错了什么以获得
尝试从仅包含13行的第0节中删除第13行 更新之前
//MARK: Swipe Cell Delegate Methods
extension TaskCardVC: SwipeTableViewCellDelegate {
func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath, for orientation: SwipeActionsOrientation) -> [SwipeAction]? {
if(orientation == .left)
{
let notInZone = SwipeAction(style: .default, title: "Not in Zone")
{
action, indexPath in
print("Send Info to Backend and Remove")
self.partsToLoad.remove(at: indexPath.row)
action.fulfill(with: .delete)
self.partsTableView.reloadData()
}
notInZone.image = UIImage(named: "not_in_zone_icon")
return [notInZone]
}
else
{
let removeAction = SwipeAction(style: .destructive, title: "Removed")
{
action, indexPath in
print("Send Info to Backend and Move part from Removals to Receivers")
self.partsToLoad.remove(at: indexPath.row)
action.fulfill(with: .delete)
self.partsTableView.reloadData()
}
removeAction.image = UIImage(named: "remove_part_icon")
return [removeAction]
}
}
func tableView(_ tableView: UITableView, editActionsOptionsForRowAt indexPath: IndexPath, for orientation: SwipeActionsOrientation) -> SwipeOptions {
var options = SwipeOptions()
options.expansionStyle = .destructive
return options
}
}