当为Mac OS X编程时,是否有一个等价于viewDidLoad? [英] When programming for Mac OS X, is there an equivalent to viewDidLoad?

查看:80
本文介绍了当为Mac OS X编程时,是否有一个等价于viewDidLoad?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

ViewDidLoad in NSViewController?

我开始开发iOS应用程式,到Mac OS X应用程序。我想知道在Mac OS X中有一个等效的方法,就像iOS的viewDidLoad在View Controller启动后运行代码。

I started development on iOS apps and am now moving to Mac OS X apps. I was wondering if there's an equivalent method in Mac OS X that is like iOS's viewDidLoad to run code after a View Controller launches.

谢谢!

推荐答案

Apple发行说明


向正在寻找用户的建议
-viewWillLoad和 - NSViewController中的viewDidLoad方法

Advice for People who Are Looking for -viewWillLoad and -viewDidLoad Methods in NSViewController

即使NSWindowController有
-windowWillLoad和-windowDidLoad方法,您可以覆盖

中引入的NSViewController类Mac OS 10.5没有
对应-viewWillLoad和
-viewDidLoad方法。您可以覆盖 - [NSViewController loadView]以自定义在视图控制器完成nib
加载之前或之后立即执行
的操作。

Even though NSWindowController has -windowWillLoad and -windowDidLoad methods for you to override the NSViewController class introduced in Mac OS 10.5 does not have corresponding -viewWillLoad and -viewDidLoad methods. You can override -[NSViewController loadView] to customize what happens immediately before or immediately after nib loading done by a view controller.

这篇关于当为Mac OS X编程时,是否有一个等价于viewDidLoad?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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