Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

North Bronson

macrumors 6502
Original poster
Oct 31, 2007
395
1
San José
Here's something I've been wondering for a while:

Take a look at one of Apple's apps (like Mail) that restores state across a Navigation Controller. If you start your app on a leaf controller and you pop back to a table view, the "selected" table cell de-selects, as if it was selected to push you to the leaf in the first place.

I can't figure out the best way to do this. Right now, I have a working app that saves state.

I thought about, while restoring the state, actually calling the appropriate tableView:didSelectRowAtIndexPath: method, but this would then load the appropriate table view, which seems like a waste if I'm just skipping over that view in the first place. This is why my current code to restore does a programmatic push without touching the table view. This doesn't give me the highlighted cell when I pop back, though.

Any ideas?
 

North Bronson

macrumors 6502
Original poster
Oct 31, 2007
395
1
San José
Code:
selectRowAtIndexPath:animated:scrollPosition:

would seem to be what you're looking for.

I thought about this, but then I'm back at my original problem.

If my hierarchy has three levels with a leaf controller at the end, restoring to the leaf controller pushes through two table view controllers. Using the selectRowAtIndexPath:animated:scrollPosition: method would load two separate table views "on the way", but the programatic push I'm using now bypasses loading the table views.

I guess I could try something in the viewWillAppear:animated: for each table view controller that would check to see if the table view should "de-select" a cell. There might be a cleaner way, though
 

rick.andrews

macrumors newbie
Feb 24, 2008
1
0
See Apple sample code DrillDownSave

This is a little late, but if you're still looking: search the ADC iPhone Reference Library for "DrillDownSave" -- it sounds exactly what you were looking for.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.