将视图控制器推入导航控制器 [英] Push View Controller into Navigation Controller

查看:82
本文介绍了将视图控制器推入导航控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有时,当我把ViewController推入导航控制器,
ViewController的viewDidLoad()方法不被调用。
这导致我的应用程序崩溃。我将感谢任何帮助。



我忘了提及我从笔尖加载视图,然后将其推送到导航控制器。



感谢您,
Sarah

解决方案

c $ c> viewDidLoad 方法仅在首次从Nib文件加载视图时调用。如果视图已加载,并且您再次按下视图,则不会再次触发。
根据你想要做什么,你可以改用 viewWillAppear viewDidAppear p>

Some times when I push ViewController into Navigation Controller, the viewDidLoad() method of the View Controller is not called. And this cause my application to crash. I would appreciate any help.

I forget to mention that I load the view from the nib before I push it to the Navigation Controller.

Thanks, Sarah

解决方案

The viewDidLoad method is only called when the view is first loaded from the Nib file. If the view was already loaded and you push the view again it will not fire again. Depending on what you want to do, you may want to use viewWillAppear or viewDidAppear instead.

这篇关于将视图控制器推入导航控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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