Andrei S Andrei S - 1 year ago 127
Objective-C Question

UITableView reload data

i'm making a navigation based application for iphone.

one of my view controllers looks like this:

@interface NewComputerViewController : UIViewController <UITableViewDelegate, UITableViewDataSource>

so i'm using a
to show data.

when the view loads, I use a button in the top navigation bar to run a function
load some stuff in a Dictionary.

My question: how do I repopulate the table view in that viewcontroller from that
function (which belongs to the view controller)

Answer Source

You can always use [tableView reloadData] method!

But if you have some data stored locally and loading new stuff from some server then you can go for:

[tableView beginUpdates];
[tableView insertRowsAtIndexPaths:*arrayOfIndexPaths* withRowAnimation:*rowAnimation*];
[tableView endUpdates];

And if you want to delete existing row you can use

[tableView beginUpdates];
[tableView deleteRowsAtIndexPaths:*arrayOfIndexPaths* withRowAnimation:*rowAnimation*];
[tableView endUpdates];
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download