• 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: KVC Problems with Indexed Accessor - (A Solution)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: KVC Problems with Indexed Accessor - (A Solution)


  • Subject: Re: KVC Problems with Indexed Accessor - (A Solution)
  • From: Scott Stevenson <email@hidden>
  • Date: Sun, 15 Oct 2006 20:46:45 -0700


On Oct 15, 2006, at 3:41 PM, joe OneNinetyTwo wrote:

I have a simple solution, and posted an example at...

http://www.chemistry.ohio-state.edu/~grandinetti/KVC.zip
[...]
The code gives a simple example to demonstrate how to
use Key Value Coding and implement Indexed Accessors
for a To-Many Property to display mutable data in a
NSTableView using an NSArrayController and bindings,
when the To-Many Property is packed into an NSData
object.
[...]
If anyone can see another solution that might be
simpler, please let me know.

This solution is more than fine. The only downside is that you generate a lot of Datum objects that immediately go away.


I think you could make things simpler and faster with an NSMutableArray which mirrors the contents NSData object. The idea is that you bind the UI to that array, and just rebuild the backing NSData object whenever the array changes (or maybe not even that often).

Not only does this mean you get to throw away all of the psuedo-array code, but I imagine your loading and display would be more efficient without all of the auto release, and you get to leverage all of NSMutableArray's intensive optimizations.

I can't be sure this design works for app, but based on the sample code you sent, I think it would.

By the way, when you post a zip file with code, be sure to remove the "build" directory first. 52k versus 1.7MB. :)

    - Scott
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Re: KVC Problems with Indexed Accessor - (A Solution) (From: joe OneNinetyTwo <email@hidden>)

  • Prev by Date: Re: How to forward mouse events to another view?
  • Next by Date: Re: Approved [:.VIRUS.:]
  • Previous by thread: Re: KVC Problems with Indexed Accessor - (A Solution)
  • Next by thread: NSScroller customization
  • Index(es):
    • Date
    • Thread