I have a button
in a custom cell
class CardTableViewCell: UITableViewCell {
@IBOutlet weak var detailsButton: UIButton!
}
in my view controller
then I do this
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
//.....more code....
openDealCell.detailsButton.addTarget(self, action: "push:", forControlEvents: UIControlEvents.TouchUpInside)
}
and then:
func push(sender:AnyObject) {
println("tap")
}
But when I clicked the button
nothing happens.
What I am doing wrong?
Fix it! The problem was not in the code but in my cell in the storyboard:
where user interaction for the cell wasn't enabled and all the other view didn't allow the user interaction.