détecter le bouton cliquer dans la vue de table ios xcode pour plusieurs lignes et sections

Je veux détecter le Bouton cliquez sur la vue tableau avec plusieurs lignes et la section. J'ai été en mesure de acheive il sur le cas d'une seule ligne, mais j'ai eu de la difficulté qu'il na pas détecter la bonne section. J'ai eu de la difficulté à détecter la section bouton l'utilisateur a cliqué sur

Ci-dessous est le code mis à jour après le problème est résolu

    @property (strong,nonatomic) NSMutableArray* quantityArray;  
@property (strong,nonatomic) NSMutableArray* rows; 
@synthesize quantityArray,rows;
- (void)viewDidLoad {
[super viewDidLoad];
quantityArray = [[NSMutableArray alloc] init];
[self PluMinusFunction];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
====================================================
if (addBtnClicked || minusBtnClicked) {
cell.lblCount.text = [[quantityArray objectAtIndex:indexPath.section-1]objectAtIndex:indexPath.row];
addBtnClicked = NO;
minusBtnClicked = NO;
}
else
{
cell.lblCount.text = [[quantityArray objectAtIndex:indexPath.section-1]objectAtIndex:indexPath.row];
}
cell.btnMinus.tag = indexPath.row;
cell.btnPlus.tag = indexPath.row;
cell.lblCount.tag = indexPath.row;
[cell.btnPlus addTarget:self action:@selector(addItem:) forControlEvents:UIControlEventTouchUpInside];
if ([ cell.lblCount.text integerValue]!=0) {
[cell.btnMinus addTarget:self action:@selector(deleteItem:) forControlEvents:UIControlEventTouchUpInside];
}
return cell;
}
}
#pragma mark - Pluys Minus Button
-(void) PluMinusFunction
{
for (int j=0; j <[itemArr count ]; j++) {
rows = [[NSMutableArray alloc] init];
for (int i=0; i <[ [[itemArr objectAtIndex:j] objectForKey:@"itemList"]count]; i++) {
[rows insertObject:@"0" atIndex:i];
}
[quantityArray insertObject:rows atIndex:j];
}
[self sum];
}
#pragma mark - UIButton selector
-(void)addItem:(UIButton*)button
{
CGPoint touchPoint = [button convertPoint:CGPointZero toView:self.tableView];
NSIndexPath *clickedButtonIndexPath = [self.tableView indexPathForRowAtPoint:touchPoint];
NSInteger row = clickedButtonIndexPath.row;
NSInteger section = clickedButtonIndexPath.section;
NSInteger  LabelText =[[[quantityArray objectAtIndex:section-1]objectAtIndex:row]integerValue]+1;
NSMutableArray *subArray = [quantityArray objectAtIndex:section-1];
[subArray replaceObjectAtIndex:row withObject: [NSString stringWithFormat:@"%ld",(long)LabelText]];
[quantityArray replaceObjectAtIndex:section-1 withObject: subArray];
addBtnClicked = YES;
NSIndexPath* rowToReload = [NSIndexPath indexPathForRow:row inSection:section];
NSArray* rowsToReload = [NSArray arrayWithObjects:rowToReload, nil];
[self.tableView reloadRowsAtIndexPaths:rowsToReload withRowAnimation:UITableViewRowAnimationNone];
}
-(void)deleteItem:(UIButton*)button{
CGPoint touchPoint = [button convertPoint:CGPointZero toView:self.tableView];
NSIndexPath *clickedButtonIndexPath = [self.tableView indexPathForRowAtPoint:touchPoint];
NSInteger row = clickedButtonIndexPath.row;
NSInteger section = clickedButtonIndexPath.section;
NSInteger  LabelValue =[[[quantityArray objectAtIndex:section-1]objectAtIndex:row]integerValue];
if (LabelValue>=1) {
NSInteger  LabelText =[[[quantityArray objectAtIndex:section-1]objectAtIndex:row]integerValue]-1;
NSMutableArray *subArray = [quantityArray objectAtIndex:section-1];
[subArray replaceObjectAtIndex:row withObject: [NSString stringWithFormat:@"%ld",(long)LabelText]];
[quantityArray replaceObjectAtIndex:section-1 withObject: subArray];
addBtnClicked = YES;
NSIndexPath* rowToReload = [NSIndexPath indexPathForRow:row inSection:section];
NSArray* rowsToReload = [NSArray arrayWithObjects:rowToReload, nil];
[self.tableView reloadRowsAtIndexPaths:rowsToReload withRowAnimation:UITableViewRowAnimationNone];
}
}

Je veux atteindre comme sur l'image ci-dessous

détecter le bouton cliquer dans la vue de table ios xcode pour plusieurs lignes et sections

lien ci-dessous donner la solution à mon problème trop

En détectant UIButton a été pressé dans un UITableView

source d'informationauteur Nischal Hada