导航控制器触发什么方法

发布于 2024-08-22 06:54:53 字数 313 浏览 3 评论 0原文

我有一个 navigationController 和 3 个视图控制器。 VC1推送VC2,VC2使用PresentModalViewController显示第三个VC

  1. 当VC2使用presentModalViewController显示VC3时,VC3实际上是否推送到navigationcontroller堆栈上?
  2. VC3 的 viewdidload 仅被调用一次。我的目标是每次都用新的 imageView 来显示 VC3。我在哪里添加代码来做到这一点? VC3 的 viewdidappear 和 viewwillappear 也不会被触发

I have a navigationController and 3 View controllers. VC1 pushes VC2 and VC2 uses PresentModalViewController to display the 3rd VC

  1. When VC2 uses presentModalViewController to show VC3, is the VC3 actually pushed on the navigationcontroller stack?
  2. viewdidload of VC3 is called only 1st time. My goal is to show VC3 with a new imageView everytime. Where do I add the code to do that? viewdidappear and viewwillappear of VC3 is not fired either

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

哭泣的笑容 2024-08-29 06:54:53
  1. 据我了解,VC3 将位于 VC2 的视图层次结构中,而不是导航控制器中。为了添加到 navigationController 的视图层次结构中,您必须将 VC3 推入其上。

  2. viewDidLoad 应该只被调用一次,除非 nib 文件本身由于内存不足而从内存中卸载。文档指出 viewWillAppear 和 viewDidAppear 应该在 VC3 上调用,所以我不知道为什么不调用它们。

更新

我刚刚测试过,VC3 确实调用了 -(void)viewDidAppear:(BOOL)animated 。确保选择器上的签名正确

  1. It is my understanding that VC3 will be in the view hierarchy of VC2 and not the navigationController. In order to be added to the view hierarchy of the navigationController you would have to push VC3 onto it.

  2. viewDidLoad should only be called once, unless the nib file itself was unloaded from memory, due to low memory. The documentation states that viewWillAppear and viewDidAppear should be called on VC3, so I don't know why they are not.

Update

I just tested and VC3 does have -(void)viewDidAppear:(BOOL)animated called. Make sure that the signature on the selector is correct

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文