swift 中未出现 UITableViewController 中的滑动操作

Swipe actions in UITableViewController not appearing in swift

我想在我的 UITableViewController 中实现滑动操作,但没有显示。

查看我的代码:

  override func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
        }

        override func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool {
            return true
        }

        override func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [UITableViewRowAction]? {
            let keep = UITableViewRowAction(style: UITableViewRowActionStyle.Default, title: "Profiter"){(UITableViewRowAction,NSIndexPath) -> Void in

                print("hello")
            }

            return [keep]
        }

尝试使用

override func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [UITableViewRowAction]? {
    let keep = UITableViewRowAction(style: .Normal, title: "Dude") { action, index in
        print("hello")
    }
    keep.backgroundColor = UIColor.redColor()
    return [keep]
}