iOS: Deselecting UITableViewCell with AutoLayout

You'll notice that when deselecting a customized UITableViewCell using tableView-deselectRowAtIndexPath:animated: method inside tableView-didSelectRowAtIndexPath: method is that its contentView gets misplaced. It's probably halfway up the cell. I really think there's a bug on this area for Apple to adress. In the meantime, to work around this bug, you only need to replace the tableView-deselectRowAtIndexPath:animated: method call with tableView-reloadData. Yes it is. And for as long you don't have such a complicated tableView and cell structure, worry not about the performance.

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
  ... dance right here ...
  [tableView reloadData];
}

0 comments :

Post a Comment

Hi there! Please leave your message here. Also, I may not be able to respond to your query right away. So please bear with me. Thanks. :)