I created one prototype cell. Cell has one label and one button. I have given tag's for both. Now i want to detect which button is clicked from 10 cells.
Previously we were differentiating that based on tag. But how to do this with prototype cell.
My code for cell creation is as follows:
- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cellIdentifier"];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"cellIdentifier"];
}
UIButton *stopStartButton = (UIButton *)[cell viewWithTag:103];
UILabel *chargingLabel = (UILabel *)[cell viewWithTag:102];
}
-(IBAction)stopStartButtonClicked:(id)sender
{
NSLog(@"Button clicked");
}