添加按钮点击事件:
[cell.buttonLeft addTarget:selfaction:@selector(onClickLeft:)
forControlEvents:UIControlEventTouchUpInside];
//获取所在cell
cell.buttonLeft.tag = indexPath.row;
-(void)onClickLeft:(UIButton *)sender{
//输出所在cell行数
[sender tag];
NSLog(@"我是第%li行左边按钮",(long)sender.tag);
}
由于知道是UIButton类型。换成id是任意类型。