Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How do I subclass NSWindowController?

0
Posted

How do I subclass NSWindowController?

0

Once you’ve decided to subclass NSWindowController, you need to make a couple of changes to the default document-based application setup. First, you should add any Interface Builder outlets and actions for your document’s user interface to the NSWindowController subclass instead of the NSDocument subclass. This is because, now, the NSWindowController subclass is the nib file’s owner. Some menu actions can still be implemented in the NSDocument subclass. For example, save and revert are implemented by NSDocument, and you might add other menu actions of your own such as an action for creating new views on a document. Second, instead of overriding windowNibName in your NSDocument subclass, override makeWindowControllers. In makeWindowControllers you should create at least one instance of your custom NSWindowController subclass and use addWindowController: to add it to the document. If your document always needs multiple controllers, create them all here. If your document will support mult

0

Once you’ve decided to subclass NSWindowController, you need to make a couple changes to the default document based application setup. First, any Interface Builder outlets and actions for your document’s user interface should be added to the NSWindowController subclass instead of the NSDocument subclass. This is because now, the NSWindowController subclass will be the nib file’s owner. Some menu actions can still be implemented on the NSDocument subclass. For example, save and revert are implemented by NSDocument, and you might add other menu actions of your own such as an action for creating new views on a document. Second, instead of overriding windowNibName in your NSDocument subclass, override makeWindowControllers.In makeWindowControllers you should create at least one instance of your custom NSWindowController subclass and use addWindowController: to add it to the document. If your document always needs multiple controllers, create them all here. If your document will support mul

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.