我有一个自定义的 UITableViewRowAction 设置和工作。我唯一无法解决的是如何在选择了一个 Action 后关闭 UITableViewRowAction。我确定我错过了一些非常明显的东西。这是我当前的设置:
func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [AnyObject]? {
var moreRowAction = UITableViewRowAction(style: UITableViewRowActionStyle.Default, title: "In", handler:{action, indexpath in
//Some code to execute here
});
moreRowAction.backgroundColor = UIColor(red: 0.298, green: 0.851, blue: 0.3922, alpha: 1.0)
return [moreRowAction];
}
感谢您的任何建议。
最佳答案
您关闭处理程序中的操作,该操作在点击操作时被调用。 The documentation描述处理程序如下
The block to execute when the user taps the button associated with this action. UIKit makes a copy of the block you provide. When the user selects the action represented by this object, UIKit executes your handler block on the app’s main thread.
独立地,我想您可以将 TableView 的 editing
属性设置为 false。
tableView.setEditing(false, animated: true)
关于ios - 关闭 UITableViewRowAction,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26197826/