我在cellForRowAtIndexPath里面有这个
cell.plusBut.tag = indexPath.row
cell.plusBut.addTarget(self, action: "plusHit:", forControlEvents: UIControlEvents.TouchUpInside)
这个函数在外面:
func plusHit(sender: UIButton!){
buildings[sender.tag].something = somethingElse
}
是否可以发送indexPath.row
and indexPath.section
或其他替代方法?
谢谢!
编辑
我是这样接近它的:
我的自定义按钮
class MyButton: UIButton{
var myRow: Int = 0
var mySection: Int = 0
}
我的自定义单元格
class NewsCell: UITableViewCell{
@IBOutlet weak var greenLike: MyButton!
在 CellForRowAtIndexPath 中
cell.greenLike.myRow = indexPath.row
我在这条线上得到一个错误。