views:

86

answers:

3

I can post code, though I'm not quite sure where to start. I have a UITableView with custom cells, in the middle tier of a three-level UINavigationView scheme. When I drill down to the bottom level and see details about my data, then use the top-left back button, my table view comes back scrolled all the way to the top, rather than scrolled down to where it was when I last saw it. Where should I look about this?

EDIT:

Here's the code in the EventsTableViewController to load an instance of EventsDetailViewController and push it on the navigation controller:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{

    NSMutableArray *events = [DataManager sharedDataManager].eventList;

    Event *selectedEvent = [events objectAtIndex:[indexPath row]];
    EventsDetailViewController *detailController = [[EventsDetailViewController alloc] initWithNibName:@"EventsDetailView" bundle:nil];
    [detailController loadEvent:selectedEvent];

    MyAppDelegate *del = (MyAppDelegate *)[UIApplication sharedApplication].delegate;
    [del.navigationController pushViewController:detailController animated:YES];
    [detailController release];

}

There's nothing in my EventsTableViewController about reloading the table, as far as I can see--I haven't implemented viewWillAppear or viewDidLoad or any of those.

+2  A: 

Are you by any chance reloading the table where you shouldn't be? In the ViewWillAppear method for example?

alku83
In my table controller? No, I haven't implemented any of those viewWill... or viewDid... methods.
Dan Ray
A: 

I was accidentally instantiating a new copy of my table view whenever I hit this level of the navigation. That's all fixed now and this isn't a problem anymore.

Dan Ray
A: 

I have a very similar question. When I go to the chatView, which is a UIViewController belonging to the navigationController and has a tableView as a subview, and then I scroll to some point, and then I go back, and then I go back to the chatView, it starts at the top again. I am allocing the tableView in loadView of the chatView, so the tableView gets realloced everytime I come back. But, isn't this standard? How do I just always scroll to the bottom like the iPhone Messages app and show the scroll bar for a few seconds at the bottom?

Here's the code:

http://github.com/acani/acani-chat/blob/master/Lovers2/Classes/ChatViewController.m#L184

Thanks!

Matt

MattDiPasquale
Try putting your table creation business in `-viewDidLoad` rather than `-loadView`. Also check out the programatic scrolling functions in UITableView, there are ways to explicitly scroll to the bottom cell.
Dan Ray