views:

594

answers:

2

Hi there! When i select a cell in my tableview, the cell was pushed to the left by the accessoryTypeCheckMark.

my custom cell was programmatically inserted into a tableview

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *selectedCell = [tableView cellForRowAtIndexPath:
       indexPath];
if (selectedCell.accessoryType == UITableViewCellAccessoryNone) {
 selectedCell.accessoryType = UITableViewCellAccessoryCheckmark;
}
else {
 selectedCell.accessoryType = UITableViewCellAccessoryNone;
}
[tableView deselectRowAtIndexPath:indexPath animated:YES];
A: 

Depending on the contents of your cell (more specifically, depending on how far to the right the text extends), the contents will be re drawn to make room for the check mark to appear.

If you don't want the text to move, you'll need to draw cell contents yourself using a custom cell subclass.

Jasarien
Hmm, I tried reducing the length of my UILabel in custom cell by 50 but it doesn't eliminate the indentation
zerlphr
A: 

Im using the same code here, and when i click the row it also check another row!! Its double checking!! Any helps?!

Kevin Lin