导航控制器触发什么方法
我有一个 navigationController 和 3 个视图控制器。 VC1推送VC2,VC2使用PresentModalViewController显示第三个VC
- 当VC2使用presentModalViewController显示VC3时,VC3实际上是否推送到navigationcontroller堆栈上?
- 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
- When VC2 uses presentModalViewController to show VC3, is the VC3 actually pushed on the navigationcontroller stack?
- 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
据我了解,VC3 将位于 VC2 的视图层次结构中,而不是导航控制器中。为了添加到 navigationController 的视图层次结构中,您必须将 VC3 推入其上。
viewDidLoad 应该只被调用一次,除非 nib 文件本身由于内存不足而从内存中卸载。文档指出 viewWillAppear 和 viewDidAppear 应该在 VC3 上调用,所以我不知道为什么不调用它们。
更新
我刚刚测试过,VC3 确实调用了
-(void)viewDidAppear:(BOOL)animated
。确保选择器上的签名正确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.
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