Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/96.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/39.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 已调用EditActionsErrorWatIndeXPath,但未显示编辑和删除_Ios_Iphone_Swift - Fatal编程技术网

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我也面临着同样的问题,你是如何解决的?你能帮我吗?我已经实现了这个方法。即使没有显示,我也实现了这个方法。即使不显示