Customize tableview cell
<p>I am creating a customize UItableviewcell. 
I have label and image(checkmark). On click of that image particular cell get checked, I did this for multiple selection, but now I want to select one cell at a time.</p>

<p>This is my code:</p>

<p>iphone</p>

<pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{
    static NSString *CellIdentifier = @"Cell";
    BOOL checkButtonPressed=FALSE;
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];

    }

    UIImage *image = (checkButtonPressed) ? [UIImage imageNamed:@"checked.png"] : [UIImage imageNamed:@"unchecked.png"];

    UIButton *checkButton = [UIButton buttonWithType:UIButtonTypeCustom];
    CGRect frame = CGRectMake(0.0, 0.0, image.size.width, image.size.height);
    checkButton.frame = frame;  // match the button's size with the image size

    [checkButton setBackgroundImage:image forState:UIControlStateNormal];



    [checkButton addTarget:self action:@selector(checkButtonTapped:event:) forControlEvents:UIControlEventTouchUpInside];
    //cell.imageView.image = [UIImage imageNamed:@"unchecked.png"];
    cell.textLabel.adjustsFontSizeToFitWidth = YES;


    for (int ii=0; ii&lt;=[checkedArr count]; ii++) {
        cell.textLabel.text =[dataArray objectAtIndex:ii];
    }

    //cell.backgroundColor = [UIColor clearColor];
    cell.accessoryView = checkButton;
    [cellArr addObject:cell];
    [checkedArr addObject:[NSNumber numberWithBool:FALSE]];

    return cell;



}

- (void)checkButtonTapped:(id)sender event:(id)event
{

    NSSet *touches = [event allTouches];
    UITouch *touch = [touches anyObject];
    CGPoint currentTouchPosition = [touch locationInView:tableView];
    NSIndexPath *indexPath = [tableView indexPathForRowAtPoint: currentTouchPosition];
    NSLog(@"val %d",[checkedArr count]);
    if (indexPath != nil &amp;&amp; iChecked == 0)
    {
        [self tableView:tableView accessoryButtonTappedForRowWithIndexPath: indexPath];
    }
}


- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath
{   
    NSLog(@"in accessoryButtonTappedForRowWithIndexPath %d",indexPath.row);

    BOOL checked = [[checkedArr objectAtIndex:indexPath.row] boolValue];


    [checkedArr replaceObjectAtIndex:indexPath.row withObject:[NSNumber numberWithBool:!checked]];

    UITableViewCell *cell = [cellArr objectAtIndex:indexPath.row];
    UIButton *button = (UIButton *)cell.accessoryView;

    UIImage *newImage = (checked) ? [UIImage imageNamed:@"unchecked.png"] : [UIImage imageNamed:@"checked.png"];
    [button setBackgroundImage:newImage forState:UIControlStateNormal];
    cell.accessoryView = button;
    iChecked = 0;



}
</code></pre>
