tableview cell value
<p>I am making an iphone application. In one of the view of the application I have implemented the table view. On each table view cell I have put one or two buttons. Now I want that whenever I click the button it give me the value of cell. How can I do it if anybody has an idea about this please let me know. </p>

<p>The code which I have implemented to display the button is:</p>

<pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
    }

    cell.textLabel.text = [rangetime objectAtIndex:indexPath.row];
    NSString *checkstatus = [finalstatusarray objectAtIndex:indexPath.row];
    if ([checkstatus isEqualToString:@"YES" ])
    {
        UIButton *submitbutton1 = [UIButton buttonWithType:UIButtonTypeCustom];
        submitbutton1.tag=1;
        submitbutton1.frame = CGRectMake(200, 4, 28, 29); 
        UIImage * btnImage1 = [UIImage imageNamed:@"yes.png"];
        [submitbutton1 setImage:btnImage1 forState:UIControlStateNormal];
        cell.accessoryView = submitbutton1;
        [submitbutton1 addTarget:self action:@selector(updatestatus) forControlEvents:UIControlEventTouchUpInside];
    }
    else if ([checkstatus isEqualToString:@"NO" ])
    {
        UIButton *submitbutton2 = [UIButton buttonWithType:UIButtonTypeCustom];
        submitbutton2.tag = 2;
        submitbutton2.frame = CGRectMake(200, 4, 28, 29); 
        UIImage * btnImage1 = [UIImage imageNamed:@"no.png"];
        [submitbutton2 setImage:btnImage1 forState:UIControlStateNormal];
        [submitbutton2 addTarget:self action:@selector(updatestatus) forControlEvents:UIControlEventTouchUpInside];
        cell.accessoryView = submitbutton2;

    }
    else if ([checkstatus isEqualToString:@"s" ])       
    {
        UIButton *submitbutton1 = [UIButton buttonWithType:UIButtonTypeCustom];
        submitbutton1.tag = 1;
        submitbutton1.frame = CGRectMake(255, 5, 28, 29); 
        UIImage * btnImage1 = [UIImage imageNamed:@"no.png"];
        [submitbutton1 setImage:btnImage1 forState:UIControlStateNormal];
        [cell  addSubview:submitbutton1];// = submitbutton1;
        [submitbutton1 addTarget:self action:@selector(updatestatus) forControlEvents:UIControlEventTouchUpInside];

        UIButton *submitbutton2 = [UIButton buttonWithType:UIButtonTypeCustom];
        submitbutton2.tag = 2;
        submitbutton2.frame = CGRectMake(285, 5, 28, 29); 
        UIImage * btnImage2 = [UIImage imageNamed:@"yes.png"];
        [submitbutton2 setImage:btnImage2 forState:UIControlStateNormal];
        [cell  addSubview:submitbutton2];
        [submitbutton2 addTarget:self action:@selector(updatestatus) forControlEvents:UIControlEventTouchUpInside];
    }
    return cell;
}
</code></pre>

<p><img src="http://i.stack.imgur.com/mN54S.png" alt="enter image description here"></p>

<p>Thanku very much.</p>
