NSWindowController与NSViewController之间的差异 [英] Difference between NSWindowController Vs NSViewController

查看:491
本文介绍了NSWindowController与NSViewController之间的差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我来自 iOS 背景,并开始学习Cocoa。在 iOS 上,除非我们有 iPad iPhone 的多个目标,一个窗口,并使用 UIViewControllers 管理屏幕。其中每个新屏幕将大部分时间映射到 UIViewController

I am coming from iOS background and starting to learn Cocoa. On iOS unless we have multiple targets for iPad and iPhone we usually have one Window and manage the screen using UIViewControllers. Where every new screen will most of the time will map to a UIViewController.

然而,在可可这似乎是另一个新的屏幕/窗口由 NSWindow 管理子组件由 NSViewController 管理。所以如果我有多个窗口应用程序,我应该为每个窗口单独 NSWindowController

However on cocoa this seems to be the otherway around where a new screen/window is manage by NSWindow and it's subcomponents are managed by NSViewController. So if I have multiple window app I should have separate NSWindowController for each window.

这种方法是正确的还是我有误解?

Is this approach correct or am I having a misunderstanding ?

推荐答案

使用iPhone SDK和Leopard SDK,他们引入了视图控制器,NSViewController和UIViewController。因为他们的名字建议他们做的是管理视图

With iPhone SDK and Leopard SDK, they introduced view controllers, or NSViewController and UIViewController. As their names suggest what they do is to manage views

视图控制器用于管理视图。 UI设计中的当前趋势是单窗口,多视图。它的意思是,有一个窗口和它内部,不同的组视图设计用于不同的目的可以交换进出。因此,视图控制器处理这些为程序员的良好的模式。
目前视图控制器对于iPhone和iPod touch编程非常重要,因为该平台基于单窗口和多视图模型。然而,它似乎对我来说,使用视图控制器是非常受欢迎的Mac。
如何对窗口控制器如NSWindowController?它的对应,UIWindowController不存在为iPhone和iPod touch环境,因为只有一个窗口的那些环境。
与视图控制器不同,NSWindowController是用于基于文档的程序。好了,基于文档的程序可以使用多个窗口。因此,有理由认为NSWindowController是用于基于文档的程序,如Apple的文档所述。

The view controllers are for managing views. Current trend in UI design is Single Window, Multiple View. What it means is that there is one Window and inside of it, different group of views designed for different purpose can be swapped in and out. So, the View Controllers handles these for programmers for well-established pattern. Currently view controllers are very important for iPhone and iPod touch programming, because the platform is based on Single-Window and Multiple View model. However, it doesn’t seem to me that using view controller is very popular for Mac. how about the window controller like NSWindowController? Its counterpart, UIWindowController doesn’t exist for the iPhone and iPod touch environment, because there is only one window for those environment. Unlike view controllers, the NSWindowController is for document based programs. Well, document based program can use multiple window. So, it is reasonable to think that NSWindowController is for document based programs as Apple’s document says.

这篇关于NSWindowController与NSViewController之间的差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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