2
override func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [UITableViewRowAction]? {
if condition == true {
let pause = UITableViewRowAction(style: .Destructive, title: "pause") { action, index in
print("pause button tapped")
return [pause]
}
} else {
return .None
}
}
此代碼沒有禁用在單元格中滑動。但是,當滑動單元刪除選項出現。請任何人都可以幫助解決這個問題。如果條件在swift中爲false,禁用swipe中的單元格?
http://stackoverflow.com/questions/34550291/disable-cell-swipe-action。 –