Posted By

off on 03/21/11


Tagged

fade app contacts uitableviewcell deselectRowAtIndexPathindexPath


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

Tintenklecks
cnathan


Fade Selected UITableViewCell like in contacts app


 / Published in: Objective C
 

URL: http://haroldcampbell.wordpress.com/2009/02/02/quick-tip-1-fade-selected-uitableviewcell/

The iPhone/iTouch Contacts app has a very cool feature. Once you have tapped on a contact, the application highlights the contact’s name and then navigates to the contact’s details. When you hit the “All Contacts” button to return to the main view of the application, the UITableViewCell that was selected fades from blue to white. Neat!

GIVE ME THE CODE!

Here’s how it’s done. Add the code below to your UITableViewController. That’s it. That’s all.

  1. -(void)viewDidAppear: (BOOL)animated
  2. {
  3. [super viewDidAppear:animated];
  4. NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
  5.  
  6. if(indexPath != nil)
  7. {
  8. [self.tableView deselectRowAtIndexPath:indexPath animated:YES];
  9. NSLog(@"deselecting this fucking row");
  10. }
  11. }

Report this snippet  

You need to login to post a comment.