You say you're calling deselectRowAtIndexPath: - tableView:willDeselectRowAtIndexPath: is only called when the row is deselected due to a user action, but in this case it's due to a programmatic action, so the delegate method won't be called. It sounds like what you want to do is to do your background swapping as a response to setHighlighted:animated: or setSelected:animated: on a cell, rather than doing it in didSelectRowAtIndexPath:
Luke On Dec 10, 2010, at 2:54 PM, Damien Cooke wrote: > 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 (Cocoa-dev@lists.apple.com) > > 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: > http://lists.apple.com/mailman/options/cocoa-dev/luketheh%40apple.com > > This email sent to luket...@apple.com _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com