Я хочу щелкнуть ячейку и вызвать действие редактирования. Но я не уверен, как реализовать вызов swipe вручную. Я думаю, что есть решение в этом ответе, но я не совсем понимаю цель C. https://stackoverflow.com/a/29839673/5737856вызов editActionsForRowAtIndexPath вручную в swift
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
// swipe
//tableView(tableView, editActionsForRowAtIndexPath: indexPath) or other functions???
}
func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool {
return true
}
func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [UITableViewRowAction]? {
let editAction = UITableViewRowAction(style: UITableViewRowActionStyle.Default, title: " Edit " , handler: { (action:UITableViewRowAction!, indexPath:NSIndexPath!) -> Void in
print("EDIT")
})
editAction.backgroundColor = UIColor.blueColor()
let deleteAction = UITableViewRowAction(style: UITableViewRowActionStyle.Default, title: "Delete" , handler: { (action:UITableViewRowAction!, indexPath:NSIndexPath!) -> Void in
print("DELETE")
})
return [deleteAction, editAction]
}
Я хочу, чтобы ячейка была пробита и показывая кнопку EDIT и кнопку DELETE, нажав на ячейку – Tony