Skip to content

Instantly share code, notes, and snippets.

@tomassliz
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomassliz/9413208 to your computer and use it in GitHub Desktop.
Save tomassliz/9413208 to your computer and use it in GitHub Desktop.
BOOL value behaviour with high optimization level
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
BOOL isMember = NO; // here must be variable set to no, otherwise is initialized to thrash
for (NSIndexPath *ip in self.expandedCells) {
if ([ip isEqualToIndexPath:indexPath]) {
isMember = YES;
break;
}
}
if (isMember) {
[self.expandedCells removeObject:indexPath];
} else {
[self.expandedCells addObject:indexPath];
}
[tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment