I have a project where I want to open a UITableViewController after a UITableViewController via a UINavigationController. The thing is, it works the first time when it gets called by this function:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
SDMetadataEntity *entity = [self.optionItems objectAtIndex:indexPath.row];
SudzcDetailViewController *detailViewController = [[SudzcDetailViewController alloc] init];
detailViewController.refName = entity.Name;
[self.navigationController pushViewController:detailViewController animated:YES];
[detailViewController release];
[entity release];
}
But when I press the back button on the navigation bar, and press the same item again, it crashes! It doesn’t crash when I press a different item in the first UITableViewController. I would really like to learn from what I am doing wrong!
You should not
because when you do
you just fetching a pointer to it, not init/copy/retaining it.