Ios 已调用EditActionsErrorWatIndeXPath,但未显示编辑和删除
我在Ios 已调用EditActionsErrorWatIndeXPath,但未显示编辑和删除,ios,iphone,swift,Ios,Iphone,Swift,我在UIViewController类中有tableView。我必须实现swipeable,当滑动时,它应该显示编辑删除,这两个动作。我的问题是,当我滑动时,它进入了方法内部,但它没有显示这两个动作 func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) { } f
UIViewController
类中有tableView。我必须实现swipeable,当滑动时,它应该显示编辑删除,这两个动作。我的问题是,当我滑动时,它进入了方法内部,但它没有显示这两个动作
func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
}
func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [UITableViewRowAction]? {
let editAction = UITableViewRowAction(style: .Default, title: "Edit") { action, index in
print("EDIT");
}
editAction.backgroundColor = UIColor.blueColor()
let deleteAction = UITableViewRowAction(style: .Default, title: "Delete") { (rowAction:UITableViewRowAction, indexPath:NSIndexPath) -> Void in
print("DELETE");
// self.confirmDelete();
}
deleteAction.backgroundColor = UIColor.redColor()
return [editAction,deleteAction]
}
我还没有实现tableview
controller。此tableview
是我的屏幕的一部分。不是全屏的。我在UITableViewController类中进行了尝试,该类正在运行
请添加此委托方法,是否有任何帮助
func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool {
return true
}
添加此委托方法
func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool {
return true
}
是否将tableview的代理设置为viewcontroller?是。tableview的行已正确呈现。当我滑动到行时,它将
editactionsforrowatinedxpath
转到该方法,但不显示EDIT/DELETEaction@Piraba我也面临同样的问题,您是如何解决的?您能帮我吗?您是否将tableview的委托设置为viewcontroller?是的。tableview的行已正确渲染。当我滑动到行时,它将editactionsforrowatinedxpath
转到该方法,但不显示EDIT/DELETEaction@Piraba我也面临着同样的问题,你是如何解决的?你能帮我吗?我已经实现了这个方法。即使没有显示,我也实现了这个方法。即使不显示