ios - 关闭 UITableViewRowAction

标签 ios swift

我有一个自定义的 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/

相关文章:

swift - PFObject 子类获取 "Cannot convert value of type ' Match' 到预期参数类型 '@noescape (AnyObject) throws -> Bool'“错误

iphone - 获取 UITableView Swift 中每一行的 RowHeight

swift - 如何在Swift中美化缓存 "pattern"?

node.js - 独立 WatchOS6 应用程序的 APNS 失败

ios - 如何从UIImagePickerViewcontroller获取缩略图和原始图像?

ios - 如何在 Google MapView iOS 中设置固定标记位置

ios - Google Drive 不允许我访问 iOS 中的所有文档和文件

ios - 根据矩形请求设置属性。 iOS, swift

ios - TestFlight 崩溃报告在 ruby​​motion 中不起作用

Swift:为什么 CGImageCreateWithImageInRect() 会创建一个大 1 像素的矩形?