【发布时间】:2016-07-18 22:46:51
【问题描述】:
我正在我的应用程序中实现UITableViewController,我想在我的表格视图中添加滑动/滑动单元格的可能性,就像在这个答案中一样:Swipe-able Table View Cell in iOS 9 但不同之处在于它只适用于一个特定的单元格,而不是全部。到目前为止,我有:
class MyTableViewController: UITableViewController {
override func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool {
return true
}
override func tableView(tableView: (UITableView!), commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: (NSIndexPath!)) {
}
override func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [UITableViewRowAction]? {
var deleteAction = UITableViewRowAction(style: .Default, title: "Hello There!") {action in
print("some action!!")
}
return [deleteAction]
}
}
它为所有单元格添加了滑动,我只想将它添加到我列表中的第三个(单元格不是动态生成的)。有没有办法做到这一点?
【问题讨论】:
标签: ios swift uitableview