gpt4 book ai didi

objective-c - 在 Xcode 4 中添加自定义对象

转载 作者:行者123 更新时间:2023-12-03 17:41:21 25 4
gpt4 key购买 nike

好的,这就是问题:

  • 我们都知道对象库,其中包含所有控件
  • 如何将自定义对象添加到该列表中? (例如,在“自定义对象”下)

我已阅读以下内容,但仍然无法使其工作(Snow Leopard 上的 Xcode 4.2):

Adding Custom Objects to the Library

Although you normally drag items out of the Library window and into your user interface, you can also drag your custom configurations of those objects back into the Library window. Doing this lets you retrieve those custom objects later without having to reconfigure them.

To add a custom object to the library, do the following:

  1. In your window, configure the object as you would like it.

  2. Press and hold the Option key and drag the object to the Library window.

  3. In the organization pane of the Library window, drop the object on the Custom Objects group or on a custom group you created. Interface Builder prompts you for information about the dropped object.

  4. Fill in the information about your object and press OK.

You can use this technique to drag one object or a group of objects. When dragging more than one object, the entire group becomes a single item in the Library window. Dragging that item back out of the library creates all of the original objects.

The items you add to the library persist between Interface Builder sessions so that you can use them over and over again. To remove a custom item from the Library window, do the following:

  1. Select the Custom Objects group in the library to see the items in that group.

  2. Select your custom item.

  3. Press the Delete key.

You must remove custom items from the Custom Objects group in order to remove them from the Library window. Removing items from your custom group folders removes them from the group but not the library.

In addition to adding custom configurations of objects to the library, you can also add entirely new objects to the library through an Interface Builder plug-in. Plug-ins are typically used in situations where you want to be able to configure and edit the attributes of your custom classes. For more information, see “Using Plug-ins to Integrate New Objects into the Library.”

有什么想法吗?

最佳答案

我与一位在 Apple 工作的 XCode 工程师进行了电子邮件交流,专门讨论了 XCode 4 中 Interface Builder 中的“自定义对象”问题,用他自己的话说,该菜单选项“不起作用”。这是他的原话,他也是 Apple 为帮助开发者提供的 WWDC 2012 视频的演示者之一。这并不是他的错,但看到这个回复我感到非常失望。

我希望他们在 XCode 的更高版本中纠正这个问题,因为这将是一个很好实现的功能。同时,我建议使用代码片段库作为解决方法。

祝您的 iOS 开发工作一切顺利:-)

关于objective-c - 在 Xcode 4 中添加自定义对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13250175/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com