如何在Xcode 4中从实体创建用户界面? [英] How do I create a user interface from an entity in Xcode 4?

查看:118
本文介绍了如何在Xcode 4中从实体创建用户界面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经尝试过几天的核心数据,花了过去几个小时试图解决如何从xcode 4中的一个实体创建一个UI。根据我一直在读的书有选项拖动核心数据实体到接口构建器的一个窗口,但是当我这样做在xcode 4,没有任何反应。
苹果文档没有帮助,因为它没有为xcode 4更新。
我相信它的东西真的很明显,但我只是不能弄清楚。

I've been experimenting with core data for a couple of days and have spent the past couple of hours trying to work out how to create a UI from an entity in xcode 4. According to the books I've been reading you have to option drag the core data entity into a window in interface builder but when I do this in xcode 4, nothing happens. The apple documentation has been no help since it hasn't been updated for xcode 4. I'm sure it's something really obvious but I just can't figure it out.

推荐答案

我最近开始学习Mac / Cocoa开发,遇到同样的问题,我的问题是非常合适的。

Your question is perfectly timed for me as I recently started learning Mac / Cocoa development and have come across the same problem.

查看文档,搜索Google,试用所有Xcode菜单选项,并使用所有可能的鼠标和键盘快捷键我可以想到我得出的结论是,不可能调用向导来生成您的实体在Xcode 4中的接口。

After looking at the documentation, searching Google, trying out all Xcode menu options and playing around with every possible mouse & keyboard shortcut I could think of I have come to the conclusion that it is not possible to invoke the wizard to generate your interface from your entities in Xcode 4.

这将回答你的

这是我做的,让我的应用程序工作(注意这也解释了在由Erik Aigner链接的视频中):

This is what I did to get my application to work (note that this is also explained in the videos linked to by Erik Aigner):


  1. 将一个新的NSArrayController拖动到您的NIB文件。打开属性检查器,将模式更改为实体,并将实体名称字段更改为实体的名称(EG Person)。

  2. 通过将项目拖动到

  3. 对于要绑定到实体的每个控件,执行以下操作:选择控件,打开绑定检查器,并将值绑定到数组控制器。控制器键字段应设置为选择,并且模型键路径应绑定到要绑定的实体的字段(EGname)。

显然,这只适用于一个非常基本的情况,但应该足以让你开始(如果你正在阅读与我一样的书,然后准备一切,在下一章再次打破当你尝试绑定到相关的实体!)。

Obviously this only caters for a very basic scenario but should be enough to get you started (If you're reading the same book as me then be prepared for everything to break again in the next chapter when you try binding to related entities!).

我的知识还有一些空白,因为我只学习Core Data 2天(和Cocoa / Objective-C不到一周),所以如果任何上述信息是错误的,那么Cocoa专家应该让我知道,我会相应地更新我的职位。

There are still a few gaps in my knowledge as i've only been learning Core Data for 2 days (and Cocoa / Objective-C for less than a week) so if any of the information above is wrong then the Cocoa experts should let me know and I will update my post accordingly.

这篇关于如何在Xcode 4中从实体创建用户界面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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