arrays - Shared Objects in Cocoa -


I am working with CoreData in Coca-Cola (not document-based). My problem is, I want to use SAME NSArrayController from different NIBs but each NIB has its own example of this NSArrayController.

My question is now how can I create a shared object (such as NSUserDefaultsController) This will help me a lot thanks to your reply =)

You generally do not want to share an NSArrayController between nibs, it would be better for many NSArrayController (one NIB copy) that all are bound to the same built-in model. If you want to apply this model (such as NSARRA) globally, you can expose it through a representative of NSAP Process (for example, your custom MyPassagate class in the MainName. NIB, Connect the code> delegate outlet to this example of your MyAppDelegate class) In other NIB, you have an NSArrayController for contentArray for binding Bai You can bind with a bonding. Delegate.myArray (Considering MyAppDelegate- via KVC-compliant methods- an NSArray binding myArray ). You are basically using the IB and the Main menu. NIB, you can create MyAppDelegate's Singleton instances.

Keep in mind that this approach examines your application difficult by the entity, because now the object graph has singleton which you can not duplicate or stub during the trial. To make NSWDU controller or NSViU controller for each secondary (non-main menu.nib) NIB and to the NSARCentors in these tubs, the file owner It would be better to pair with Maraira . Then you can instantiate the NSWWO controller or NSVUUU controller, before passing the secondary NIB, you can pass an array (or ARL KVC-COMBI object). In this way, you can check the functionality in the isolation (using fake or stub for Array).


Comments