为什么我的视图控制器不调用-(void)viewDidAppear:(BOOL)动画方法? [英] why my view controller not call the - (void)viewDidAppear:(BOOL)animated method?

查看:204
本文介绍了为什么我的视图控制器不调用-(void)viewDidAppear:(BOOL)动画方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在viewDidAppear方法中做一些事情,但是该方法不能自动调用SDK 描述此方法的方法是通知视图控制器其视图已添加到窗口.如果在我的视图控制器中实现此方法可以自动调用?

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];
    ...
}

推荐答案

这取决于您如何将视图添加到视图层次结构.例如,如果将控制器推入导航堆栈中,则将自动调用此方法.但是,如果您手动"添加视图,例如使用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.

这篇关于为什么我的视图控制器不调用-(void)viewDidAppear:(BOOL)动画方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆