在我的UITableView中有时候触摸后单元格仍然保持选中状态。由于它只偶尔发生,我无法重现这个问题。
有什么提示吗?也许与tableView的释放不当有关?
- (void)tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
NSUInteger row = [indexPath row];
[tableView deselectRowAtIndexPath:indexPath animated:YES];
switch (row) {
case 0:
FruitViewController *fruitController = [FruitViewController alloc];
[fruitController retain];
[fruitController initWithNibName:@"FruitView" bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:fruitController animated:YES];
[fruitController release];
break;
case 1:
CerealsViewController *cerealsController = [CerealsViewController alloc];
[cerealsController retain];
[cerealsController initWithNibName:@"CerealsView" bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:cerealsController animated:YES];
[cerealsController release];
break;
default:
break;
}
}