• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
TableView deselection issue
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: TableView deselection issue
      • From: Luke the Hiesterman <email@hidden>
  • Prev by Date: Re: iOS: Monospaced fonts aren't?
  • Next by Date: Re: TableView deselection issue
  • Previous by thread: Re: Implementing async notifications
  • Next by thread: Re: TableView deselection issue
  • Index(es):
    • Date
    • Thread