Monday 15 August 2011

iphone - save selected row in UITableView after reloadData -


I write a custom jabber client in the iPhone.

I use it as an engine.

And I have the USTableViewController with NSMutableArray for the Resistance Contact list.

When I (or any material it changes) roster (aka contact list) I want to change the UITableView item (add / remove / modify). Therefore, if the user works with the list, then update

  by [item addObject: newItem] in the time list; [Self.tableViewReloadData];  

User has lost the current selection item.

So, my question is how is left (if possible, I mean the selected item has not been deleted) Reload Select existing item after data?

Thx. The easiest way is to:

  NSIndexPath * ipath = [ Self.tableView indexPathford selected]; [Self.tableViewReloadData]; [Self.tableView selectRowAtIndexPath: animated ipath: no scrollPosition: UITableViewScrollPositionNone];  

No comments:

Post a Comment