Gili Ariel
Gili Ariel

Reputation: 602

reloading tableview with data from child view

i'm new im making an app with a login screen , when the user logs in successfully i receive json data from server and i load it up in my next view Tableview navigation controller, when i press one of my cells i go to another view a uiview where there i send data to the server and receive new data when i go back to my table view i want to reload the table with the new data.

and in my tableview i coded [table reloaddata] in viewwillappear and its not loading the new data , i hope i was clear ! thanks!

Upvotes: 0

Views: 89

Answers (1)

MirekE
MirekE

Reputation: 11555

The missing part here is the connection between the data and your table view. The table view must implement UITableViewDataSource (and UITableViewDelegate) protocol and must have methods like

- (UITableViewCell *)tableView:(UITableView *)tableView
     cellForRowAtIndexPath:(NSIndexPath *)indexPath

This one gives you ID of the row and you provide value(s) that should appear in that row

- (NSInteger)tableView:(UITableView *)tableView
     numberOfRowsInSection:(NSInteger)section

This one asks how many rows in total should be in the table. These are called when you call reloadData.

If you have them already, I would check if the arrays you use to populate the table actually contain any data at the time you call reloadData and double check that the reloadData and subsequently the cellForRowAtIndexPath actually get called.

Upvotes: 0

Related Questions