如何使用 Xcode 4 将 .xib 文件链接到类文件 [英] How to link a .xib file to a class file with Xcode 4
问题描述
已经在新的Xcode4下启动了一个通用项目.我的应用程序适用于 iPhone &iPad 设备,但不适合 iPad.我有 2 个用于 MainWindow 的 .xib 文件:MainWindow.xib(iPhone 设备)&MainWindow-Ipad.xib(iPad 设备).但我的 MainView 只有一个 .xib 文件:MainView.xib.
have started a universal project under the new Xcode4. My Application works on both iPhone & iPad devices but not well design for the iPad. I have 2 .xib file for the MainWindow: MainWindow.xib (iPhone device) & MainWindow-Ipad.xib (iPad device). But only one .xib file for my MainView: MainView.xib.
所以我正在尝试为 iPad 设备创建一个特定的 .xib 文件:
So I'm trying to create a specific .xib file for the iPad Device:
新建文件 > 用户界面 > 查看 -> 下一个 -> 设备系列:iPad -> MainView-iPad.xib -> 保存
New file > User interface > View -> next -> device family : iPad -> MainView-iPad.xib -> save
当然,没有任何联系,没有引用出口,没有任何类的链接.
And of course, there is nothing connected,no referencing outlet, no link to any class.
我检查了我的新 MainView-iPad.xib 的每个缩略图,以便将它链接到我的 MainViewController 类,但没有成功!?
I check each thumbnail of my new MainView-iPad.xib in order to link it to my MainViewController class without success !?
在哪里或如何将它链接到我的 MainViewController 类?提前致谢.
Where or how can I link it to my MainViewController class? Thanks in advance.
推荐答案
user763308 给出了正确答案:
The correct answer was given by user763308:
将 .xib 链接到 Xcode4 下的类:
To link a .xib to a class under Xcode4:
- 打开您的 .xib.
- 在占位符中:选择文件的所有者.
- 在右侧面板的第三个缩略图:身份检查器"中,编辑自定义类"字段并输入您的类的名称.
我也不得不:
- 单击对象下的根视图.
- 点击最后一个标签:显示连接".
- 将新引用出口"拖到文件所有者"并选择查看".
这篇关于如何使用 Xcode 4 将 .xib 文件链接到类文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!