title: Refreshing the UITableView only works when I move the table?
body: <p>I have a UITableView where a user clicks on an accessory.  The accessory launches a UIView in modal view (using <code>presentViewController</code>).</p>
  
  <p>When it returns it is meant to update the tableview cell with the required data. </p>
  
  <p>Currently I am using a Singleton to capture userData inside a dictionary; but even if I use a NSNotification I have the same issue.</p>
  
  <blockquote>
    <p>My issue is that when the modal dialog is dismissed the tableview never updates; however 
    if I scroll or otherwise physically move then table the entry in the cell is updated.</p>
  </blockquote>
  
  <p>I get the same results if I try to force reload a cell or the entire tableview with NSNotifications.</p>
  
  <p>I am wondering if I can get some help on this; how do I make the cell reload?</p>
  
  <p>The code relating to cell display and how the modal is presented is below;</p>
  
  <p>Notes;</p>
  
  <p><code>_eventName is just a NSString</code></p>
  
  <pre><code>-(void) viewDidAppear:(BOOL)animated {
      [super viewDidAppear:animated];
  
      if ( [[MySingleton sharedInstance].userData objectForKey:@"eventName"] !=nil) {
          _eventName = [[MySingleton sharedInstance].userData objectForKey:@"eventName"];
      }
  }
  
  // Customize the appearance of table view cells.
  - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  {
      static NSString *CellIdentifier = @"Cell";
  
      NSDictionary *dict;
      NSString *name;
  
      UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
      if (cell == nil) {
          cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
          cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
          cell.selectionStyle = UITableViewCellSelectionStyleNone;
      }
  
      dict = [_template objectAtIndex:indexPath.row];
      name = [dict objectForKey:@"name"];
  
      cell.textLabel.text = name;
  
      NSString *key = [[dict objectForKey:@"key"] lowercaseString];
  
      if ([[key lowercaseString] isEqualToString:@"name"]==YES) {
          cell.detailTextLabel.text = _eventName;
      }
  
  
  
      return cell;
  }
  
  
  
  -(void) tableView:(UITableView *)tv accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath
  {
      NSDictionary *dict = [_template objectAtIndex:indexPath.row];
      NSString *key = [[dict objectForKey:@"key"] lowercaseString];
  
      NSString *name = @"";
  
      if ([key isEqualToString:@"name"]==YES) {
  
          EventNameVC *nameEditor = [[EventNameVC alloc] initWithNibName:@"EventNameVC" bundle:nil];
  
          if (_eventName !=nil) {
              nameEditor.txtName.text = _eventName;
          } else {
              nameEditor.txtName.text = name;
          }
  
          UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:nameEditor];
  
  
  // When we return from the view, reload the cell.
          [self presentViewController:nav animated:YES completion:^{
  
              [self.tv reloadRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationRight];
  
          }];
  
          nav = nil;
      }
  
  }
  </code></pre>
  
  <hr>
  
  <p>Edit: Tried to use a notification to detect the modal's closure; but I still have the same issue -- that is, the UITableView only displays the updated data when I physically move the table.</p>
  
  <p>In my view controller I do this;</p>
  
  <pre><code>- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
  {
      self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
      if (self) {
          // Custom initialization
  
          NSOperationQueue *mainQueue = [NSOperationQueue mainQueue];
  
          self.notificationObserver = [[NSNotificationCenter defaultCenter]
                                       addObserverForName:@"dismissModalView"
                                       object:nil
                                       queue:mainQueue
                                       usingBlock:^(NSNotification *notification) {
                                          NSLog(@"Notification received!");
  
                                          NSDictionary *userInfo = notification.userInfo;
                                          _eventName = [userInfo objectForKey:@"eventName"];
  
                                          NSLog(@"received._eventName = %@", _eventName);
  
                                           [self performSelectorOnMainThread:@selector(updateTable) withObject:nil waitUntilDone:YES];
                                      }];
  
      }
      return self;
  }
  
  -(void) updateTable {
  NSLog(@"%s", __PRETTY_FUNCTION__);
  [self.tv reloadData];
  }
  </code></pre>
  
  <p>I launch my modalView inside the <code>accessoryButtonTappedForRowWithIndexPath</code> method</p>
  
  <pre><code>EventNameVC *nameEditor = [[EventNameVC alloc] initWithNibName:@"EventNameVC" bundle:nil];
          UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:nameEditor];
          [self presentViewController:nav animated:YES completion:nil];
  </code></pre>
  
  <p>Okay, so when we launch the modal view using <code>presentViewController</code> and on dismissal, the notification is fired.</p>
  
  <p>In my modal view</p>
  
  <pre><code>-(IBAction) btnSave:(id)sender {
      [self.txtName resignFirstResponder];
  
      ///[[MySingleton sharedInstance].userData setObject:self.txtName.text forKey:@"eventName"];
      NSDictionary *userInfo = [NSDictionary dictionaryWithObject:self.txtName.text forKey:@"eventName"];
      [[NSNotificationCenter defaultCenter] postNotificationName:@"dismissModalView" object:self userInfo:userInfo];
      [self dismissViewControllerAnimated:YES completion:nil];
  }
  </code></pre>
  
  <p>When I run this, the updateTable is fired correctly and logged in the console.</p>
  
  <p>So far so good.</p>
  
  <p>But the tableview still has not refreshed its data; I still have to physically move the table to make the cell update.</p>
  
  <p>What can I do to force the cells to update to correctly?</p>