How many controller classes are typical in a cocoa application?

When designing my application, how many controllers do I need? Is it right to have one controller for the whole application, the whole window, or for each class? In addition, how many objects are intended for many created in the doc window in Interface Builder. Textbooks usually have an app called AppController. Do full applications usually have an App Controller or n * XYZController?

+3
source share
2 answers

In a non-document based application, one for each window. I am talking only about controllers that you write yourself, and not about window controllers, view controllers, object controllers, array controllers, tree controllers, or dictionary controllers. (Note that some people make their NSWindowController user controller.) I also do not consider the application delegate to which your root controller (s) belongs.

In a single-window application, this usually means one user controller.

In a document-based application, you do not write controllers at all, but write one or more subclasses of NSDocument instead of one for each type of document. Each document object usually has exactly one window.

, , ( ), : , NSFontPanel NSColorPanel.

+4

, , - , - . : , , .

, , : importController textFilesImportController externalFilesDisplayController - , , .

, , , . , .

+1

Source: https://habr.com/ru/post/1720943/


All Articles