0
votes

I'm programmatically switching TabBarController views from a modal view controller (see this question). The delegate correctly switches the tabs, but viewDidAppear isn't getting called in the newly presented tab. Is there any way to force viewDidAppear to get called? Or am I doing something wrong?

3

3 Answers

0
votes

Finally got this figured out - it was because I was calling the tab switch before dismissing the modal view. Once I switched the order, it worked fine.

-1
votes

Force to call the viewDidAppear;

- (void)viewController:(YourViewControllerSubclass *)viewController isBeingDismissedWithImage:(BOOL)imageTaken {
  // Select the tabbar index (which is the second controller)
  [secondController viewDidAppear:YES];
}
-1
votes

I had the same issue before. In my TabBarViewController's viewDidLoad(), I selected other tab programatically as selectedIndex = 3. The target viewController's viewDidAppear() isn't called. But if I move selectedIndex = 3 from viewDidLoad() to viewDidAppear(), the problem is solved.