views:

21

answers:

1

I am working with a UITableViewController subclass, that is supposed to go from a "Login Table" (a table containing a UITextField for the username and for the password and a Start Session cell), when the user touches the "Start Session" cell the UITableViewController should be reloaded and just show one cell with a "Log Out" label.

The problem is that when I reload the info some cells appear to be "selected" (like in blue) and some cells don't have the title they should.

I am reloading the tables this way:

    [[self tableView] beginUpdates];
    [[self tableView] deleteSections:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, 2)] withRowAnimation:UITableViewRowAnimationTop];
    [[self tableView] insertSections:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, 0)] withRowAnimation:UITableViewRowAnimationTop];
    [[self tableView] endUpdates];

Depending on which table I'm reloading the Ranges would change but that's the basic Idea, is there something I am missing?

A: 
    [[self tableView] beginUpdates];
[[self tableView] deleteSections:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, 0)] withRowAnimation:UITableViewRowAnimationBottom];
[[self tableView] insertSections:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, 2)] withRowAnimation:UITableViewRowAnimationBottom];
[[self tableView] endUpdates];

[[self tableView] beginUpdates];
[[self tableView] reloadSections:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, 2)] withRowAnimation:UITableViewRowAnimationBottom];
[[self tableView] endUpdates];

[[self tableView] reloadData];

That combination of methods seem to be working, I don't know, I don't like it, will leave it like this until I find a better solution.

El Developer