How to update UITableViewCell label related to user location without reload entire UITableView data?

StackOverflow https://stackoverflow.com/questions/22759239

سؤال

I want to load a UITableView that show many addresses. The right detail label of a cell is the distance between the user location and the place. At the beginning, it should be "-" (waiting for user location) and when user location is updated, it should be "450m" for example.

I thought to adding observer to each cells and post notification, but i feel like there is a best way to do it.

هل كانت مفيدة؟

المحلول

try to get indexpath value of that cell and relaod that particuler cell .

 NSIndexPath* rowToReload = [NSIndexPath indexPathForRow:indexValue inSection:0];
 NSArray* rowsToReload = [NSArray arrayWithObjects:rowToReload, nil];
[self.favoritesTableView reloadRowsAtIndexPaths:rowsToReload withRowAnimation:UITableViewRowAnimationNone];
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top