UITableView reloaddata problem when having a MKMapview in a tableview cell
I am writing an app can load data from from web, then put the data in a grouped uitableview, where I put data in the first section, and meantime, I want to plot these data on a mapview in the second section of table.
I managed to implement these in the tableview, and it works fine. Then I add a refresh button on the navigation bar, so if someone press the refresh button, the app will fetch data from web again and reload the tableview with the new dat开发者_运维问答a.
Here comes the problem, when I refresh the data and call the method reloaddata, all table cells in both section get refreshed, I mean, the map is re-loaded and animated zoom in from world map to the interest region every time I press the refresh button. But I only want re-plot the annotations based on the refreshed data, not the map.
I think the problem come from the call of [self.tableView reloadData] method. Is there a way just to reload data for the first section rather than all sections in a grouped tableview?
Any suggestion or comment is appreciated! Thanks!
You can use - reloadRowsAtIndexPaths:withRowAnimation:
(in the UITableView Class Reference) to do just that. You will just need to create an NSArray of the index path/paths of the row/rows you want to update and it will reload just those
精彩评论