I've got a UITableViewCell that contains a button, I handle this button click event follow this link Get button click inside UI table view cell,
Here is my code:
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
cell.directCommentButton.tag = indexPath.row;
cell.directCommentButton.addTarget(self, action: "directCommentButtonClicked", forControlEvents: UIControlEvents.TouchUpInside)
return cell
}
func directCommentButtonClicked(sender: AnyObject) {
// directComment = 1
println("DIRECT COMMENT")
}
but there is an error directCommentButtonClicked]: unrecognized selector sent to instance 0x7f9e50590f10'
and app has crashed. When I remove the sender: AnyObject, the error disappear, but I want to get the sender, how can I do that. Tks in advance