title: How can I reload tableview in viewDidLoad using delegate?
body: <p>I have simply TODO list in which there are:</p>
  
  <ul>
  <li>protocol's method <code>reloadTableViewWhenItChanges</code>;</li>
  <li>fetch data (i.e. core data);</li>
  </ul>
  
  <p>Table view reloads after stop/run compiler.
  But I need to reload table view in <code>viewDidLoad</code> (not in <code>viewWillAppear</code>/<code>viewDidAppear</code>), using delegation table reloads only after something has changed in <code>managedObjectContext</code>.</p>
  
  <p>How can I do that? </p>
  
  <p>Here is my code (what is wrong in it? Where do I have to put <code>[self.tableView reloadData]</code> in my code, for example?):</p>
  
  <pre><code> - (void)viewDidLoad {
       [super viewDidLoad];
       self.title = @"Note List";
       self.barButtonAddNote = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd
                                                                             target:self
                                                                             action:@selector(addNewNote:)];
       [self.navigationItem setRightBarButtonItem:self.barButtonAddNote animated:YES];
       [self reloadTableViewWhenItChanges]; }
  
   - (void)reloadTableViewWhenItChanges // protocol's method {
       self.addNoteViewController.delegate = self;
       if ([self.managedObjectContext hasChanges])
       {
           NSError *error;
           [self.managedObjectContext save:&amp;error];
       }
       [self fetchData];
       [self.tableView reloadData]; }
  
   - (void)fetchData {
       NSFetchRequest *request = [[NSFetchRequest alloc]init];
       NSEntityDescription *note = [NSEntityDescription entityForName:@"Note"
   inManagedObjectContext:self.managedObjectContext];
       [request setEntity:note];
  
       NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"task" ascending:YES];
       NSArray *sortDescriptors = [NSArray arrayWithObjects:sortDescriptor, nil];
       [request setSortDescriptors:sortDescriptors];
  
       NSError *error = nil;
       NSArray *mutableFetchResults = [self.managedObjectContext executeFetchRequest:request error:&amp;error];
  
       if (mutableFetchResults != nil){
           self.notesArray = [[NSMutableArray alloc] initWithArray:mutableFetchResults];
       } }
  </code></pre>