I have a top level UIViewController
that contains a UITableView
. The top level UIViewController
instantiates a NavigationController
viewWillAppear
gets called every time the view appears include the first time.
Here is my solution for reload the view only when you navigate back
I create one variable in .h file
of my ViewController
for checking that it is the first time I go to this ViewController
or when I navigate back
@property (nonatomic) BOOL isViewExist;
After that in viewWillAppear
-(void)viewWillAppear:(BOOL)animated{
if(!self.isViewExist){
self.isViewExist = YES; // check it is the first time you go to this ViewController -> don't reload anything
}else{
[self.tableView reloadData]; // to reload the tableview data
// or your can refresh anything in your ViewController as you want
}
}
Hope this help