viewDidAppear and viewWillDisappear not being call

2019-04-16 04:05发布

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 ?

2条回答
虎瘦雄心在
2楼-- · 2019-04-16 04:14

When initializing from a nib, you can use the awakeFromNib method.

查看更多
叛逆
3楼-- · 2019-04-16 04:28

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.

查看更多
登录 后发表回答