通过在TableView创建cell时,获取button的tag值,然后赋值给button。
当button点击时,然后就有了一个tag。然后就可以区分开点击了哪一个button了。
UITableView.m中定义
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{[cell setSubTag:indexPath.row];
}
cell.m中定义如下
- (void)jumpSellOptionButton : (id)sender{
NSLog(@"welcome !!!! tag=%ld", ((UIButton *)sender).tag);
}
- (void)setSubTag:(NSInteger)aTag
{
_pBuyButton.tag = aTag;
_exeSellButton.tag = aTag;
}