xcode iPhone OS > 用户界面的 Window XIB 和 View XIB 模板之间的区别在哪里?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/729314/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Where is the difference between an Window XIB and an View XIB template for iPhone OS > User Interfaces?
提问by Thanks
Like I understand it, if I would take the View XIB, I had an Content View where I can put UI control elements inside.
就像我理解的那样,如果我使用 View XIB,我有一个内容视图,我可以在其中放置 UI 控制元素。
But what's an Window then? Isn't that pretty much the same thing?
但是什么是窗口呢?这不是差不多一样的东西吗?
回答by Michael Fey
On the iPhone each app typically has one window and multiple views. In your case you would design your UI in the View XIB and at runtime that would be added to your app's window. You can use the MainWindow XIB to setup a view controller to swap views in and out of your app as needed.
在 iPhone 上,每个应用程序通常都有一个窗口和多个视图。在您的情况下,您将在 View XIB 中设计您的 UI,并在运行时将其添加到您的应用程序窗口。您可以使用 MainWindow XIB 设置视图控制器,以便根据需要在应用程序内外交换视图。
For more information about windows and views see the Windows and Views section of the iPhone Application Programming Guide
有关窗口和视图的更多信息,请参阅iPhone 应用程序编程指南的 Windows 和视图部分
回答by cdespinosa
A window is twoviews: the frame view (which contains controls that only AppKit has access to, like the zoom, hide, close, and maximize buttons, and the title bar and proxy icon), and the content view, which you control.
一个窗口是两个视图:框架视图(包含只有 AppKit 可以访问的控件,如缩放、隐藏、关闭和最大化按钮,以及标题栏和代理图标)和内容视图,您可以控制它们。
If you're designing an area you're going to embed within another view, or hand off to an API that wants a view (for example, to create a panel or sheet), then use a view. If you're designing something to specifically be a window, like a document window, then use a window.
如果您正在设计一个区域,您打算将其嵌入到另一个视图中,或者移交给需要视图的 API(例如,创建面板或工作表),那么请使用视图。如果您正在设计一些专门用作窗口的东西,例如文档窗口,那么请使用窗口。
With a window, you have additional abilities to control its appearance and behavior, for example, to make it modal, give it a proxy icon, list it in the Windows menu, order it relative to other windows, etc. that you can't do with a plain view.
对于窗口,您有额外的能力来控制其外观和行为,例如,将其设置为模态、为其指定代理图标、将其列在 Windows 菜单中、将其相对于其他窗口进行排序等,这是您无法做到的做一个简单的视图。