gpt4 book ai didi

iphone - Interface Builder 中的占位符对象

转载 作者:行者123 更新时间:2023-12-03 16:04:40 25 4
gpt4 key购买 nike

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

我知道存在的占位符类型有:文件所有者、第一响应者和应用程序委托(delegate)

链接:

最佳答案

我从 Apple 开发者网站 Interface Builder 复制了此内容。 ,希望这有帮助。

基本上用我自己的话说,占位符保存了程序中的所有内容,它们由用户看到的所有内容组成,例如 UIViewUIImageView,类似的东西

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 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.

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.

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.

关于iphone - Interface Builder 中的占位符对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1911916/

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