Note that there are some explanatory texts on larger screens.

plurals
  1. POviewwillappear and viewdidappear not called
    text
    copied!<p>this question is very frequent, but I am not able to solve it with any answers available.</p> <p>I am working on iOS 5.1. My navigation controller is one tab amongst tab bar view controllers. There's a tableview, in which selecting of a row pushes new view controllers.</p> <p>This problem occurs Only on selecting of the second row and only sometimes. It's not regular. The Pushed view comes blank - <code>viewWillAppear</code>/<code>viewDidAppear</code> are not being called. On clicking the back button of the navigation bar - the root view's <code>viewWillAppear</code>/<code>viewDidAppear</code> are also not being called, making it blank.</p> <p>I am pushing the view on select of first row/second row in exactly the same way. But the problem occurs only on the second row.</p> <pre><code>- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ switch (indexPath.row) { case 0: AViewController *aObj = [[AViewController alloc] init]; aObj.homeObj = self; [self.navigationController pushViewController:aObj animated:YES]; [aObj release]; break; case 1: BViewController *bVCObj = [[BViewController alloc] init]; bVCObj.homeObj = self; [self.navigationController pushViewController:bVCObj animated:YES]; [bVCObj release]; break; default: break; } [tableView deselectRowAtIndexPath:indexPath animated:YES]; } </code></pre> <p>I have tried <a href="https://stackoverflow.com/questions/4289617/why-isnt-viewwilldisappear-or-viewdidappear-being-called?rq=1">this</a> and <a href="https://stackoverflow.com/questions/3560669/viewwillappear-viewdidappear-not-being-called-not-firing">this</a> but in vain.</p> <ol> <li><p><code>viewDidLoad</code> is being called on pushing the <code>BViewController</code>, However, <code>viewWillAppear</code> and <code>viewDidAppear</code> is not being called. Following is my <code>viewDidLoad</code>:</p> <pre><code>- (void)viewDidLoad { [super viewDidLoad]; self.view.backgroundColor = [UIColor blackColor]; NSLog(@"nav stack: %@", [self.navigationController viewControllers]); NSLog(@"nav stack: %@", [[self.navigationController visibleViewController] description]); //some initialization and call of methods } </code></pre></li> <li><p>It's not regular. Sometimes I get this scenario, and this continues until I close the app from the background and restart it. But sometimes it works just fine. I am just pushing my view controller to the nab stack.</p></li> <li><p>As I mentioned in the comment, It's a regular navigation controller in tab bar controller.</p></li> </ol>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload