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
.
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 ?
UIViewController
doesn't manage theUIWindow
- theUIWindow
manages theUIViewController
. Although there is usually only one UIViewController on-screen at a time (this has changed in iOS5 with child view controllers), they are still subcomponents of the UIWindow. Case in point, a UIWindow has a rootViewController property, but viewcontrollers don't have a window property. Now, with OSX, you can have multiple NSWindows, but they still manage their respective NSViewControllers. In short, hierarchy is: Window > ViewController > Views – Sewn