I have a simple table view, with a custom cell build in it, the custom cell has two buttons ( later they will be used as Down Vote and UpVote buttons ), is there a way for to pass the indexPath.row value to the button, in order to me to identify which cell button was clicked?
TablewViewController.swift
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as CustomTableViewCell
cell.piadaTitulo.text = "Lorem Ipsum"
cell.piadaDescription.text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean commodo volutpat lectus, vitae semper tortor finibus at. Cras erat ligula, egestas sed tincidunt eget, condimentum maximus lectus. Aenean varius semper tellus, id congue lacus pretium a"
return cell
}
CustomTableViewCell.Swift
@IBOutlet weak var piadaTitulo: UILabel!
@IBOutlet weak var piadaDescription: UILabel!
@IBAction func piadaUpVote(sender: AnyObject) {
println("UPVOTE clicked")
}
@IBAction func piadaDownVote(sender: AnyObject) {
println("DOWNVOTE clicked")
}

tagproperty to the row in yourcellForRowAtIndexPathfunction. Then just use sender.tag in theIBActions to know the row.