У меня есть несколько кнопок в UITableViewCell. Только последняя кнопка кликабельна. Я определил свою кнопку в customCell.h
файле
Ниже приведен мой код.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
CustomCell *cell;
if (IS_IPAD) {
cell = [tableView dequeueReusableCellWithIdentifier:@"VCustomCell_iPad"];
}else{
cell = [tableView dequeueReusableCellWithIdentifier:@"CustomCell_iPhone"];
}
NSDictionary *dicCustom = [self.arrCustom objectAtIndex:indexPath.row];
[cell configureVanStockDetail:dicCustom];
[cell.btnOrder addTarget:self action:@selector(btnPurchaseOrderClicked:) forControlEvents:UIControlEventTouchUpInside];
return cell;
}
Следующий код взят из customCell.h
файла
@property (strong, nonatomic) UIButton *btnOrder;
Код из CustomCell.m
file
- (void) configureVanStockDetail:(NSDictionary *)objCustom {
...
...
int count = 0
for (NSDictionary *dicPO in arrPO) {
self.btnOrder = [UIButton buttonWithType:UIButtonTypeCustom];
self.btnOrder.translatesAutoresizingMaskIntoConstraints = NO;
self.btnOrder.tag = count;
[self.contentView addSubview:self.btnOrder];
count++;
}
}
Исходя из приведенного выше кода, кто-нибудь может сказать мне, почему нажимается только последняя созданная кнопка.