【发布时间】:2015-11-27 20:03:20
【问题描述】:
我在 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 和 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
我在这一行得到一个错误。
【问题讨论】:
标签: ios swift uitableview button sender-id