返回时弹出 ViewController 不会调用 viewWillAppear [英] Popping ViewController doesn't call viewWillAppear when going back

查看:30
本文介绍了返回时弹出 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?)

推荐答案

UINavigationController 的内部"不能有 UITabBarController.这可能就是为什么没有调用某些 viewWillAppear 方法的原因.看看这里:导航内的标签栏控制器控制器,或共享导航根视图

You cannot have a UITabBarController "inside" of a UINavigationController. That's probably why some of the viewWillAppear methods aren't being called. Take a look here: Tab bar controller inside a navigation controller, or sharing a navigation root view

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

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆