在 nib 文件中创建类的实例 [英] Create instance of class in nib file

查看:25
本文介绍了在 nib 文件中创建类的实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在阅读 Apple 的 OSX Cocoa(您的第一个 Mac 应用程序)教程,并且正在学习 重构应用委托.我已经创建了自己的控制器类.

Im going through Apple's OSX Cocoa (Your First Mac Application) tutorial and am up to refactoring the app delegate. I have created my own controller class.

我不明白如何在 nib 文件中创建控制器类的实例".我使用的是 Xcode 4.

I don't understand how to "Create an instance of the controller class in the nib file". I'm using Xcode 4.

推荐答案

从右侧窗格的对象库"中将对象"拖到您的笔尖上.接下来,选择您拖入笔尖的对象,然后选择身份检查器(右上方窗格中左起第三个图标).从这些中,您可以设置自定义类.将类设置为您创建的自定义控制器.这将在笔尖初始化时为您创建.然后,您可以将其连接到 AppDelegate 中的 IBOutlet(对于该自定义类).

Drag an 'Object' from the 'Object Library' in the right pane onto your nib. Next, select the object that you dragged into the nib, and then select the identity inspector (third icon from the left in the top right pane). From these, you can set a custom class. Set the class to be the custom controller that you have created. This will be created for you when the nib is initialized. You can then connect this to an IBOutlet in your AppDelegate (for that custom class).

这篇关于在 nib 文件中创建类的实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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