I'm really sorry for my english and if I make something wrong, and this is my first question here.
I have a custom UITableViewCell as a view in *.xib file. with an UIImage in it and a button on that UIImage. I connected this button with an outlet to my CustomTableViewCell.swift class.
@IBOutlet weak var authorImage: UIImageView!
@IBOutlet weak var authorButton: UIButton!
In the MyTableViewController.swift I've registered a nib
tableView.registerNib(UINib(nibName: "CustomTableViewCell", bundle: nil), forCellReuseIdentifier: "my_cell")
And wrote an cellForRow... function like this:
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("my_cell", forIndexPath: indexPath) as! CustomTableViewCell
cell.authorButton.addTarget(self, action: "authorButtonPressed:", forControlEvents: .TouchUpInside)
return cell
}
And, finally I have this function (which I use in addTarget...):
func authorButtonPressed (sender:UIButton!) {
print("Hi!")//line1
print(sender)
}
and a breakpoint on the first line. But this function is never called.
And I have also just understood that button isn't animated, when I tap it.
How can I fix it or find a way to the solution?
Thank you in advance