简体   繁体   中英

viewDidAppear and viewWillDisappear not being called in UIViewController

I am creating a UIViewController using the nib file ?

I have implemented the following 2 methods

  • (void)viewDidAppear:(BOOL)animated
  • (void)viewWillAppear:(BOOL)animated

in my view controller, but these methods are not getting called every time ?

What is the error in the code ?

从笔尖初始化时,可以使用awakeFromNib方法

Depending on how you load your viewController, your

(void)viewDidAppear:(BOOL)animated
(void)viewWillAppear:(BOOL)animated

will not get called.

Here is one way I load viewcontrollers. As you see, I explicitly call viewDidAppear, viewDidDisappear, etc. myself.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM