【发布时间】:2016-02-04 18:20:49
【问题描述】:
我有一个名为“激活”的行操作按钮。当我按下它时,我希望标题变为“停用”。
我无法在处理函数中更改标题。另外,“Activate”和“Deactivate”应该有不同的功能。
func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [AnyObject]? {
let account = accountTypes[indexPath.section].accounts[indexPath.row]
let delete = UITableViewRowAction(style: UITableViewRowActionStyle.Default, title: "Delete", handler: { (action, indexPath) -> Void in
// action delete
})
let activation = UITableViewRowAction(style: UITableViewRowActionStyle.Default, title: "Activate", handler: { (action, indexPath) -> Void in
// action activate
})
activation.backgroundColor = UIColor.lightGrayColor()
let arrayofactions: Array = [delete, activation]
return arrayofactions
}
【问题讨论】:
标签: ios swift uitableview cocoa-touch uitableviewrowaction