TableView deselection issue
TableView deselection issue
- Subject: TableView deselection issue
- From: Damien Cooke <email@hidden>
- Date: Sat, 11 Dec 2010 09:24:45 +1030
Hi All,
I have a perplexing yet, probably, very simple problem. I have a tableView that when a cell is selected I pop in a different cell background (just a little pizzazz) only problem is that it is all backfiring on me as my willSelectRowAtIndexPath gets called fine and my funky image gets popped in nicely, yet my willDeselectRowAtIndexPath does not get called and so the image is still there when I get back to the table. I am calling deselectRowAtIndexPath as per documentation. I have my delegate set I have really no idea where to look next. Can anyone assist me please?
Damien
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView deselectRowAtIndexPath:indexPath animated:NO];
AdvancedDetailViewController *advancedDetailController = [[AdvancedDetailViewController alloc] init];
AdditiveEntity *additiveEntity = [[self fetchedResultsController] objectAtIndexPath:indexPath];
[moreAdvancedDetailController setAdditiveEntity:additiveEntity];
// Pass the selected object to the new view controller.
[self.navigationController pushViewController:advancedDetailController animated:YES];
[advancedDetailController release];
}
- (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(@"willselectRowAtIndexPath");
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
cell.backgroundView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"selectedTablecellBackground.png"]] autorelease];
return indexPath;
}
- (NSIndexPath *)tableView:(UITableView *)tableView willDeselectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(@"willDeselectRowAtIndexPath");
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
cell.backgroundView = nil;
return indexPath;
}_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden