0

我正在以编程方式从模态视图控制器切换 TabBarController 视图(请参阅此问题)。委托正确地切换选项卡,但viewDidAppear没有在新呈现的选项卡中被调用。有没有办法强制 viewDidAppear 被调用?还是我做错了什么?

4

3 回答 3

0

终于弄明白了——这是因为我在关闭模式视图之前调用了选项卡开关。一旦我切换了订单,它就可以正常工作。

于 2012-08-30T04:14:27.707 回答
-1

强制调用viewDidAppear;

- (void)viewController:(YourViewControllerSubclass *)viewController isBeingDismissedWithImage:(BOOL)imageTaken {
  // Select the tabbar index (which is the second controller)
  [secondController viewDidAppear:YES];
}
于 2012-08-30T00:09:03.483 回答
-1

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.

于 2017-02-14T07:53:13.490 回答