Interface Builder中的占位符对象 [英] Placeholder objects in Interface Builder

查看:135
本文介绍了Interface Builder中的占位符对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以解释Interface Builder文档窗口中可能出现的占位符对象的类型吗?

Could someone explain the kinds of placeholder objects that may appear in the Interface Builder document window?

我知道的占位符的种类有:文件的所有者响应者和应用程序代表

The kinds of placeholders that I know exist are: File's owner, First Responder and App Delegate

链接:

  • This thread explains First Responder.
  • This thread explains the App Delegate.
  • iPhone Interface Builder and Delegates: Answers the question, but not very clearly

推荐答案

我已从界面上的苹果开发者网站复制此内容生成器,希望这有助于。

I copied this from apple's Developer website on Interface Builder, Hope this helps.

基本上用我自己的话,占位符持有程序中的一切,它们包括用户看到的一切,如UIView或UIImageView,沿着这些行

Basically in my own words the place holders hold everything in your program and they consist of everything that the user see's, like a UIView or a UIImageView, something along those lines


选择适当的控制器对象

在Cocoa和Cocoa Touch nib文件中,文件的所有者占位符对象提供应用程序和nib文件中的对象之间的关键链接。加载nib文件时,必须为指向该文件所有者的对象提供一个指针的nib加载例程。作为加载过程的一部分,nib加载代码自动重新创建您指定的对象与具有与文件所有者的连接的nib文件对象之间的任何连接。

Choose Appropriate Controller Objects

In Cocoa and Cocoa Touch nib files, the File’s Owner placeholder object provides the key link between your application and the objects in the nib file. When you load the nib file, you must provide the nib-loading routine with a pointer to the object that should become the File’s Owner. As part of the loading process, the nib-loading code automatically recreates any connections between the object you specify and the nib file objects that have connections to the File’s Owner.

As您设计应用程序的架构,考虑哪些对象要管理您的nib文件是很重要的。只有一个文件的所有者占位符对象的存在是没有很好的理由。通常最好有一个对象协调nib文件及其内容的加载和管理。这个单一的联系点在应用程序的数据模型和用于呈现数据模型的可视元素之间提供了所需的障碍,并且是模型 - 视图 - 控制器设计的核心。

As you design the architecture of your application, it is important to consider which objects you want to manage your nib files. The presence of only one File’s Owner placeholder object is not without good reason. It is usually best to have a single object coordinate the loading and management of a nib file and its contents. This single point of contact provides the desired barrier between your application’s data model and the visual elements used to present that data model and is at the heart of model-view-controller design.

超出文件所有者对象,可以直接在nib文件中创建其他控制器对象,以管理nib文件的子集。以这种方式使用多个控制器,您可以将窗口的行为划分为更易于管理的块。例如,如果您的窗口有多个不同的信息窗格,您可以创建单独的控制器对象来管理每个窗格。

Beyond the File’s Owner object, you can create additional controller objects directly in your nib file to manage subsets of the nib file. Using multiple controllers in this way lets you compartmentalize the window’s behavior into more manageable chunks. For example, if your window has multiple panes of disparate information, you could create separate controller objects to manage each pane. Each controller would continue to go through the File’s Owner to obtain additional information.

在iPhone应用程序中,除了文件所有者之外,还可以在nib文件中包括占位符对象。这些附加的占位符对象几乎总是用于表示应用程序已经使用的导航控制器和其他视图控制器。这些附加的占位符对象的存在不会减少文件的所有者的角色。文件的所有者对象仍然负责协调nib文件内容的整体行为。

In iPhone applications, it is also possible to include placeholder objects besides File’s Owner in your nib file. These additional placeholder objects are almost always used to represent navigation controllers and other view controllers already in use by your application. The presence of these additional placeholder objects does not diminish the role of File’s Owner though. The File’s Owner object is still responsible for coordinating the overall behavior of the nib file’s contents.

这篇关于Interface Builder中的占位符对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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