Note that there are some explanatory texts on larger screens.

plurals
  1. POuitableview reloadRowsAtIndexPaths not working
    text
    copied!<p>I have a <code>tableviewcell</code> in the <code>RegisterViewController</code>, when i click on it, it push to the <code>SelectCityViewController</code> where i can pick a city from a <code>uipickerview</code>. and I have defined a delegate in the <code>SelectCityViewController</code>. But when i implement the delegate method, i got the city back from the <code>pickerview</code> and the selected <code>indexpath</code> from <code>didSelectRowAtIndexPath</code> in <code>RegisterViewController</code>. When i check the log, i get the city, and the selected <code>indexpath</code>. but when i call <code>reloadRowsAtIndexPaths</code>, the cell still got the old titlelabel text. the code:</p> <pre><code>SelectCityViewController.h @protocol SelectCityDelegate &lt;NSObject&gt; - (void)didGetCity:(City *)city; @end SelectCityViewController.m - (void)finished:(UIBarButtonItem *)buttonItem { if ([self.delegate respondsToSelector:@selector(didGetCity:)]) { [self.delegate didGetCity:self.city]; } NSLog(@"%@", self.city.city); [self.navigationController popViewControllerAnimated:YES]; } RegisterViewController.m - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { if (indexPath.section == 2) { self.selectedIndexPath = indexPath; UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" bundle:nil]; SelectCityViewController *signUp = [storyBoard instantiateViewControllerWithIdentifier:@"SignVC"]; signUp.delegate = self; [self.navigationController pushViewController:signUp animated:YES]; } } - (void)didGetCity:(City *)city { NSLog(@"%@", city.city); NSLog(@"%@", selectedIndexPath); UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:selectedIndexPath]; cell.textLabel.text = city.city; [self.tableView reloadRowsAtIndexPaths:@[selectedIndexPath] withRowAnimation:UITableViewRowAnimationFade]; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload