why my view controller not call the - (void)viewDi

2019-09-05 06:30发布

I want to do something in the viewDidAppear method but this method not auto calling the SDK describe this method is Notifies the view controller that its view was added to a window. if means implement this method in my view controller can auto calling?

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
    ...
}

1条回答
我命由我不由天
2楼-- · 2019-09-05 06:57

It depends on how you add your view to the view hierarchy. If you push your controller on an navigation stack for example, this method will be called automatically. If however you add the view 'manually', for example using addSubview: then you yourself are responsible for calling this method on the controller.

查看更多
登录 后发表回答