UITableView select and deselect row

-(void) tableView:(UITableView *)tableView didDeselectRowAtIndexPath:
    (NSIndexPath *)indexPath {
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
}

That's an infinite loop, I'm quite certain. However... it's sort of on the right track. You can move that method call into didSelectRowAtIndexPath:.

- (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:
    (NSIndexPath *)indexPath {
    //stuff
    //as last line:
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
}

For that matter, deselectRowAtIndexPath can be called from anywhere at any time you want the row to be deselected.

[self.myTableView deselectRowAtIndexPath:[self.myTableView 
    indexPathForSelectedRow] animated: YES];