I have an array of 37 objects and this objects has to be listed in a tableview cell. And for each cell I have created custom buttons. So 37 buttons. For each button I have given a image just as check box. If a button is selected the image changes. Now i want to know which button in which cell is clicked.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
// Configure the cell..
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(34, 4, 300, 30)];
label.text=[categoryarray objectAtIndex:[indexPath row]];
[cell.contentView addSubview:label];
UIButton *cellbutton=[[UIButton alloc]initWithFrame:CGRectMake(0, 10, 20, 20)];
cellbutton.tag=[indexPath row];
[cellbutton setBackgroundImage:[UIImage imageNamed:@"bfrtick.png"] forState:UIControlStateNormal];
[cellbutton addTarget:self action:@selector(button1Tapped:) forControlEvents:UIControlEventTouchUpInside];
[cell.contentView addSubview:cellbutton];
return cell;
}