0
我知道Objective-C存在同樣的問題,它沒有答案,但也許有人有一個想法。Swift:UITableView單元格中的按鈕被滑動刪除觸發
我有一個的UIButton在的UITableView細胞:
let tButton = UIButton(type: UIButtonType.Custom)
tButton.addTarget(self, action: "buttonTap:", forControlEvents: .TouchUpInside)
cell.contentView.addSubview(tButton)
而且我commitEditingStyle委託看起來是這樣的:
func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
if (editingStyle == UITableViewCellEditingStyle.Delete) {
tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Automatic)
}
}
當我在按鈕啓動刷卡,按鈕目標被解僱。