为什么我的视图控制器不调用 - (void)viewDidAppear:(BOOL)animated 方法?
我想在 viewDidAppear 方法中执行一些操作,但此方法不会自动调用 SDK 描述此方法是通知视图控制器其视图已添加到窗口。 if 意味着在我的视图控制器中实现这个方法可以自动调用吗?
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
...
}
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];
...
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这取决于您如何将视图添加到视图层次结构中。例如,如果您将控制器推送到导航堆栈上,则会自动调用此方法。但是,如果您“手动”添加视图,例如使用
addSubview:
,那么您自己负责在控制器上调用此方法。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.