• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Core data, NSArrayController and different nibs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Core data, NSArrayController and different nibs


  • Subject: Core data, NSArrayController and different nibs
  • From: Tomaž Kragelj <email@hidden>
  • Date: Thu, 6 Nov 2008 08:50:44 +0100

It looked so trivial at the start, but didn't work as expected - my single window application uses the following setup:

- MainMenu.nib: my AppController and all the NSArrayControllers with bindings set properly so when an item is selected in the master controller, it's details are handled by children controllers (all data comes from managed context).
- MainWindow.nib: the main window with placeholder view (and the rest of the common user interface).
- CustomView.nib: the actual views are implemented each in a separate nib and are then moved as child view in the main windows placeholder when necessary (similar to Apple's ViewController sample).


The problem I have is that the custom views need the data from the array controllers defined in MainMenu.nib. It seemed logical to create outlets to the array controllers in my AppController and expose them through accessors to the rest of the controller layer. In my custom views I would then bind the controls to these (like Application.delegate.arrayController.arrangedObjects.key for example). But this doesn't work - the bindings are ok, there's no error, but I get no data.

So my next try was to add "proxy" array controllers inside the custom view nibs and bind their content array to the file's owner representedObject (which is set manually to the corresponding array controller before the nib is loaded - like [viewController setRepresentedObject:[[NSApp delegate] arrayController]]). This works, but selection in master array controller is not propagated to the custom view proxy child controller. Furthermore, if I release the custom view and create it again, the contents are empty (it only works the first time).

I am at the moment refactoring my application from single nib to above structure. All was working when the views were living in the same nib as array controller! Am I missing something here?

I'd like to stick with the first alternative (but need to get it working first...) - without going through proxy controllers. It looks cleaner. Is this the right design choice?

Thanks, Tom



_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Core data, NSArrayController and different nibs
      • From: Quincey Morris <email@hidden>
    • Re: Core data, NSArrayController and different nibs
      • From: Cathy Shive <email@hidden>
  • Prev by Date: Re: Making a Window Class Invocable from Any Thread
  • Next by Date: Re: Spin Progress Indicator is not spinning
  • Previous by thread: Re: Performance problems with doubleClickAtIndex
  • Next by thread: Re: Core data, NSArrayController and different nibs
  • Index(es):
    • Date
    • Thread