• 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
Re: Bindings: Custom Controller Keys ...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bindings: Custom Controller Keys ...


  • Subject: Re: Bindings: Custom Controller Keys ...
  • From: mmalcolm crawford <email@hidden>
  • Date: Sun, 1 Aug 2004 13:14:31 -0700

On Aug 1, 2004, at 11:49 AM, J Nozzi wrote:
If you have 4 distinct collections of objects, then each should be managed by a
different array controller. If all the collections are contained in the same
collection in another object, then you will need a means of separating them.
One means that comes to mind is to use indexed accessors -- create a different
set of accessors for each subset...
So then, what's the best way to merge all the arrays' contents using Bindings (so it's 'live) into one controller to view all these different objects in one view? They all inherit from an abstract class that holds all the common attributes that I want to display together.

I'm not sure now if I've understood your requirements.
Is the following example analogous to your situation?

You have an array of Products. Product is an abstract superclass of LawnMower, Toaster, SurfBoard, and EggCup. You want to display a composite view of all Products in one table view.

Is this is the case, simply bind the table columns as you would if you had a homogeneous array to

[Product Array(*)].arrangedObjects.property

with Product Array's content array bound to:

[File's Owner(*)].productsArray

(*) or whatever.

You won't be able to "sensibly" connect a button to the array controller's addObject: action since you'll probably define the "Object Class Name" to be Product, but you could subclass NSArrayController to provide addLawnMower:, addToaster: etc. methods...



If you need to display toasters, egg cups, and surf boards in different table views, then they should be managed by different array controllers -- even if they're contained in the same array. One way to do this might be to provide indexed array accessors for the different "virtual" arrays, that all refer back to the "composite" array:

- (int)countOfLawnMowers
{
// return number of lawn mowers in productsArray
}


mmalc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >Re: Bindings: Custom Controller Keys ... (From: <email@hidden>)
 >Re: Bindings: Custom Controller Keys ... (From: J Nozzi <email@hidden>)

  • Prev by Date: Re: Categories and adding instance variables
  • Next by Date: Re: cocoa app from scratch
  • Previous by thread: Re: Bindings: Custom Controller Keys ...
  • Next by thread: NSDateFormatter, Interface Builder, and System Preference date formats
  • Index(es):
    • Date
    • Thread