Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我怎样才能比较viewDidLoad和viewDidAppear:
viewDidLoad
viewDidAppear:
最好的办法是在视图控制器中实现这两种方法,该控制器加载带有子视图的视图(最简单的是来自 NIB)并在每个方法中放置一个断点。当应用程序在每个断点处停止时,查看调试器中的变量视图并查看已实例化的对象。
为了消除对UIViewController生命周期的混淆,下面是一张来自 Big Nerd Ranch iOS Programming 的图表:
UIViewController