I am trying to update some of my views when they appear, so I naturally found myself using the viewDidAppear: and viewWillAppear: methods. However, I have experienced two problems with using these methods:
- When I only implement one of the methods, the changes that I am looking to make are not completely there, so in order for everything to work, I implemented both methods with the same code.
- Even after implementing both methods with the same code, there is a 0.5 to 1 second delay when updating the view's content.
Here is my code for my custom made table view controller:
-(void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[self.tableView reloadData];
}
-(void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
[self.tableView reloadData];
}
For some reason, I must call the reloadData method twice to completely update my table view.
Here is my code for my custom made normal view controller:
-(void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
navItem.title = @"Name1";
nameLabel.text = @"Name1";
nameField.hidden = YES;
}
-(void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
navItem.title = @"Name1";
nameLabel.text = @"Name1";
nameField.hidden = YES;
}
Thank you!