• 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
NSController design question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSController design question


  • Subject: NSController design question
  • From: Josh Anon <email@hidden>
  • Date: Fri, 16 Jan 2004 08:54:52 -0800

Here's what I'm trying to do: present an app that has a popup button with playlist names and a table with tracks. I've written this without bindings, but it'd be nice to simplify this code. Last night, I was messing around, and I came up with this design:

track: class that has various attributes
model: loads data into an array with playlist names and a dictionary where key = playlist name, value = array of tracks
window controller: has currentPlaylist var, IBOutlets to 2 NSArrayControllers
nib: popup bound to the name array controller, selected bound to window controller's currentPlaylist
table bound to the other array controller

In the win controller, in setCurrentPlaylist:, I manually set the track controller's content to be [[self model] tracksForPlaylist:currentPlaylist]. Yuck. It seems like there'd be a way to do this without code.

The other alternatives I can see still require coding, though. For example, keep a currentTracks array in the win controller, bind to that, and change its value when the currentPlaylist changes. The other idea would be (since you can't have vars in key paths, as far as I know) to not have a currentPlaylist var, but just to change the 2nd array controller's key path each time the currentPlaylist changes.

Any opinions?

Thanks,
Josh

---
Josh Anon
Studio Tools, Pixar Animation Studios
email@hidden
_______________________________________________
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.

  • Prev by Date: ANN: IDEKit - Framework for programmer editors
  • Next by Date: Re: Cocoa App daemon with NSPanel
  • Previous by thread: Re: ANN: IDEKit - Framework for programmer editors
  • Next by thread: NSBorderlessWindowMask shadows
  • Index(es):
    • Date
    • Thread