iPhone,addSubView不会调用willViewAppear? [英] iPhone, addSubView doesn't call willViewAppear?

查看:106
本文介绍了iPhone,addSubView不会调用willViewAppear?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 -addSubView 添加视图。我也在其他地方使用视图和 presentModalViewController

I'm adding a view with -addSubView. I'm also using the view elsewhere and presentModalViewController.

-viewWillAppear 使用presentModalViewController调用,但不调用addSubView。

-viewWillAppear is called with presentModalViewController but not with addSubView.

毫无疑问这是显而易见的事情?

No doubt this is something obvious ?

推荐答案

viewWillAppear:当父视图控制器呈现另一个视图控制器时调用>(例如,通过 pushViewController:animated: presentModalViewController:animated:)。当您手动调用 addSubview时,它永远不会被调用:

viewWillAppear: is called by the parent view controller when it presents another view controller (e.g. by pushViewController:animated: or presentModalViewController:animated:). It is never called when you manually call addSubview:.

这篇关于iPhone,addSubView不会调用willViewAppear?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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