ios - 快速 editActionsForRowAtIndexPath

标签 ios swift tableview

我正在尝试在我的表格 View 中添加一些编辑操作。但是,我不知道要为 UITableViewRowAction! 添加什么内容。它在代码中表示为IDK

func Done(UITableViewRowAction!,
    NSIndexPath!) -> Void {

}

override func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [AnyObject]? {

    let complete = UITableViewRowAction(style: UITableViewRowActionStyle.Default, title: "Done", handler: Done(_IDK_, indexPath))

    let arrayofactions: Array = [complete]

    return arrayofactions
}

最佳答案

func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [AnyObject]? {
    let delete = UITableViewRowAction(style: .Normal, title: "Delete") { action, index in
        println("delete")
    }
    let done = UITableViewRowAction(style: .Default, title: "Done") { action, index in
        println("done")
    }
    return [delete, done]
}

关于ios - 快速 editActionsForRowAtIndexPath,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26206358/

相关文章:

swift - NSTimer 在后台模式下使用 locationManager 委托(delegate) ("Cheat way") SWIFT

ios - Swift UnsafeMutablePointer<Unmanaged<CFString>?> 分配和打印

java - FXML TableView "Class fxmlPerson does not support property "bestellnr"

ios - 在 Swift for iOS 中解包可选值时意外发现 nil

ios - 使用 AVPlayer-Swift 无缝循环播放视频

ios - NSDate 根据时区字符串变化

ios - titleLable.text 不工作

ios - 快速截取 Textfield 的屏幕截图?

ios - 停止 TableView 单元格 UIImage 在 iOS 中调整大小

ios - 用于处理删除的操作表 UIButton