Comment faire pour centrer le texte dans un UITableViewCell lorsque l'accessoire est UITableViewCellAccessoryCheckmark

J'essaie de conserver le texte centré dans un UITableViewCell, quand j'ai le accessoryView ensemble de UITableViewCellAccessoryCheckmark. Je suis également en utilisant une table de montage avec cette classe.

Voici une capture d'écran de ce que je ne veux pas.

Comment puis-je arrêter le texte étant en retrait de la gauche?

Comment faire pour centrer le texte dans un UITableViewCell lorsque l'accessoire est UITableViewCellAccessoryCheckmark

Mon willDisplayCell méthode..

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
    if (indexPath.row == [self cellToCheckmark]) {
        cell.accessoryType = UITableViewCellAccessoryCheckmark;
    }
    else {
        NSLog(@"Not Being Checked");
        cell.accessoryType = UITableViewCellAccessoryNone;
    }

cell.textLabel.textAlignment = UITextAlignmentCenter;

    if (cell.shouldIndentWhileEditing == YES) {
        cell.shouldIndentWhileEditing = NO;
    }
}

CellForRowAtIndexPath:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    UITableViewCell *cell = nil;

    static NSString *CellIdentifier = @"Cell";
    cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
    }

    cell.textLabel.textAlignment = UITextAlignmentCenter;

    if (indexPath.section == 0) {
        switch (indexPath.row) {
            case 0:
                cell.textLabel.text = @"Google";
                break;

            case 1:
                cell.textLabel.text = @"Bing";
                break;

            case 2:
                cell.textLabel.text = @"Yahoo!";
                break;

            default:
                break;
        }
    }

    if (indexPath.row == [self cellToCheckmark]) {
        NSLog(@"Being Checked");
        cell.accessoryType = UITableViewCellAccessoryCheckmark;
    }
    else {
        NSLog(@"Not Being Checked");
        cell.accessoryType = UITableViewCellAccessoryNone;
    }

    if (cell.shouldIndentWhileEditing == YES) {
        cell.shouldIndentWhileEditing = NO;
    }   
    return cell;
}

OriginalL'auteur W Dyson | 2012-05-31