Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to dynamically update table view in IOS?

Tags:

ios

iphone

i have a table and custom cells created dynamically, i have a http asyn call which gets me JSON data, now i need to update the table cells with the data received...

like image 255
Jeba Prince Avatar asked Sep 12 '11 04:09

Jeba Prince


2 Answers

Call:

[self.tableView reloadData];
like image 185
Nathanial Woolls Avatar answered Oct 18 '22 19:10

Nathanial Woolls


Have to NSNotification, one in the loadview and another one in the

- (void)connectionDidFinishLoading:(NSURLConnection *)connection  

delegate method , like this:

 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateTable) name:@"downloadCompleted" object:nil];

The above one in loadview method and the following one in the delegate

[[NSNotificationCenter defaultCenter] postNotificationName:@"downloadCompleted" object:nil];

the updateTable method will be called once data is obtained from JSON parsing. You can call the reloadData method of the tableview in this method to fill the tableview with obtained values.... Hope this helps.. Cheers...Happy coding..

like image 43
stack2012 Avatar answered Oct 18 '22 19:10

stack2012