In this code I have a problem with the highlighted line. When I visit this tableview for the second time, I need to put the checkmark back where it was as I am reusing this view twice....sorry I'm so rusty I haven't touched my app since April...I need to figure out why it is over released is it tableView or lastIndexPath...it will typically skip over the reset fields part unless i specifically call for a new game.
Code:
- (void)viewWillAppear:(BOOL)animated {
BOOL resetFields = NO;
if ([Singleton sharedSingleton].cellSelection == 0)
resetFields = [Singleton sharedSingleton].resetTeam1SelectionView;
else if ([Singleton sharedSingleton].cellSelection == 1)
resetFields = [Singleton sharedSingleton].resetTeam2SelectionView;
if (resetFields) {
self.lastIndexPath = nil;
NSIndexPath *topIndexPath = [NSIndexPath indexPathForRow:0 inSection:0];
[self.tableView selectRowAtIndexPath:topIndexPath animated:NO scrollPosition:UITableViewScrollPositionMiddle];
if ([Singleton sharedSingleton].cellSelection == 0)
[Singleton sharedSingleton].resetTeam1SelectionView = NO;
else if ([Singleton sharedSingleton].cellSelection == 1)
[Singleton sharedSingleton].resetTeam2SelectionView = NO;
}
[self.tableView selectRowAtIndexPath:lastIndexPath animated:NO scrollPosition:UITableViewScrollPositionMiddle];
[self.tableView reloadData];
// [self setTitle: [[self listData] objectAtIndex:parentCellSelection]];
[self.navigationItem setLeftBarButtonItem:nil animated:NO];
[self.navigationItem setRightBarButtonItem:nil animated:NO];
[super viewWillAppear:animated];
}