Difference between NSWindowController Vs NSViewController

前端 未结 3 1910
逝去的感伤
逝去的感伤 2021-02-03 22:55

I am coming from iOS background and starting to learn Cocoa. On iOS unless we have multiple targets for iPad and iPhone

3条回答
  •  北荒
    北荒 (楼主)
    2021-02-03 23:14

    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

    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.

提交回复
热议问题