问题描述
有时,当我把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.
这篇关于将视图控制器推入导航控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!