ViewController不会调用viewWillAppear

ViewController不会调用viewWillAppear

本文介绍了返回时弹出ViewController不会调用viewWillAppear的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当我手动弹出一个视图控制器时, viewWillAppear 都不会在现在出现的前一个 UIViewController 上被调用。

Whenever I pop a view controller manually, viewWillAppear doesn't get called on the previous UIViewController that now appears.

这是2个常规 UIViewControllers 。我的应用程序设置如下:

These are 2 regular UIViewControllers. My application setup is like this:

- UINavigationController
   - UITabViewController with 5 UIViewControllers including UIViewControllerA
      -UIViewControllerA (When I get back here, viewWillAppear doesnt get called)
        -UIViewControllerB (I'm here, I want to pop to A)

我尝试手动调用 viewWillAppear ,但这也无济于事。可能有什么不对?我的最后一招将弹出B和A,然后创建一个新的A,并推动它,但这只是最后的手段(我认为这会有用吗?)

I've tried calling viewWillAppear manually, but that doesn't help either. What could be wrong? My last resort will be popping B, and A, and then creating a new A, and pushing that, but that's only as a last resort(I assume this will work?)

推荐答案

它不会被调用,因为视图在导航控制器内,但我在这里找到了一个解决方案:

It will not get called because the view is inside the navigation controller, but I found a solution here:

希望有所帮助。

这篇关于返回时弹出ViewController不会调用viewWillAppear的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 22:27