I have ViewController (A) with TableView where each row is a directory name. Each row is pushing a new ViewController (B). Inside ViewController B I am running method to delete the currently opened directory. However, when I pop the view and go back to TableView I obviously still have this directory on list. How can I fix it?
How can I refresh the TableView while going back in navigation?
And no, simple [self.tableView reloadData]
inside -viewWillAppear
doesn't really work.
Code:
My -viewWillAppear:
- (void)viewWillAppear:(BOOL)animated {
NSString *docDir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
self.arrFolders = [[NSMutableArray alloc] init];
[self allFilesInDocuments:docDir];
}
-allFilesInDocuments is just adding items to array ([arrFolders addObject:folder];
).
Inside -tableView:cellForRowAtIndexPath:
I add data with
cell.textLabel.text = [arrFolders objectAtIndex:indexPath.row];