0

How to achieve a similar iTunes artists view like effect where all objects are concentrated in one row of a NSTableView just like this image:

enter image description here

So far I've achieved the same effect by adding an object named "all objects" and monitoring if the user has selected the first index of the table view, but it seems like poor practice since I'm even repeating the values inside the "all objects" index.

Is there an out of the box way of doing this or I should subclass NSArrayController? Thanks in advance for all the help

Bruno Vieira
  • 3,884
  • 1
  • 23
  • 35
  • "All Artists" is just one thing. It doesn't really magically contain all artists. – matt May 16 '14 at 23:25
  • But in case of using a NSArrayController, how to change only this one thing? – Bruno Vieira May 16 '14 at 23:32
  • The first thing in the array is the thing called "All Artists". It doesn't have to _do_ anything until the user taps it. – matt May 16 '14 at 23:44
  • Suppose I have an array that goes "All Composers", "Beethoven", "Bach", "Mozart". Throw an array controller and a table view at it and you're done. Why is there a problem? – matt May 16 '14 at 23:46
  • So there is no better way than adding an item named "All Objects" to the NSArrayController before displaying it (which I'm already doing)? – Bruno Vieira May 16 '14 at 23:59
  • What could be "better"? I still don't see why there's a problem. – matt May 17 '14 at 00:23
  • Given all the hidden functionality buried in IB, I understand the question, but no, there's not going to be a magical checkbox that does this for you. Too many questions about what the arrayController should do if the user selects the "all" object and deletes it. But if you want hierarchy, use an NSOutlineView and a Tree Controller. – stevesliva May 17 '14 at 02:16
  • I solved the hierarchy problem using a nssortdescriptor with an enumerator, but it feels weird – Bruno Vieira May 18 '14 at 03:09

1 Answers1

0

I would try subclassing NSTableViewCell and dynamically add whatever content you want to that cell as you populate the table.

Literphor
  • 498
  • 4
  • 16
  • But that would not be an "out of the box" solution, I thought of extending NSTableView or NSArrayController, but that seemed overkill. – Bruno Vieira May 16 '14 at 23:38