I connected mainViewController and customTableViewController with a “push” segue. The mainViewController pass an array of data to customTableViewController in prepareForSegue. If the array is empty, customTableViewController should automatically pop back to the mainViewController.
My code looks like this:
//customTableViewController.m
- (void) viewDidload
{
if (self.array.count == 0) {
[self.navigationController popViewControllerAnimated: YES];
}
}
But all i got is a blank and black view if the array is empty, not the mainViewController.
If i call popViewControllerAnimated manually (such as pushing a button), everything just works as i expected. So, what should i do?
Thank you all in advance.
Try to use your code in
-viewDidAppear:(BOOL)animated