• 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
NSDictionary, NSTableView and binding
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSDictionary, NSTableView and binding


  • Subject: NSDictionary, NSTableView and binding
  • From: Jeff Andrews <email@hidden>
  • Date: Mon, 20 Mar 2006 17:36:41 -0500

All,

I'm sorta lost. I have a NSTableView that binds to a NSDictionary using
a NSArrayController. I believe I have the right binding names etc. via Interface Builder.
Both key and values in the Dictionary are strings.


I am reading the NSDictionary from a file.  For example:

<plist version"1.0">
    <key>People</key>
    <dict>
         <key>John</key>
         <dict>
               <key>age</key><string>29</string>
               <key>height</key><string>5 Foot 10 inches</string>
        </dict>
        <key>Mary</key>
         <dict>
               <key>age</key><string>27</string>
               <key>height</key><string>5 Foot 3 inches</string>
        </dict>
    </dict>
</plist>

I want auto populate the table view with the NSDictionary from People.
What do I need to do to this?

Right now this is the code I have:

NSDictionary* dictionary = [NSDictionary dictionaryWithContentsOfFile:filename];
// we just want the People
NSDictionary* people = [dictionary objectForKey:@"People"];


	// enumerate through the people
	NSEnumeration* enumerator = [people objectEnumerator];
	NSDictionary* person = nil;

	while ( ( person = (NSDictionary*) [enumerator nextObject] ) )
	{
		// ???
		[tableView ?: person];
	}

What do I need to replace the question marks with, or am I going about
it all wrong?

Thanks,

Jeff
_______________________________________________
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


  • Follow-Ups:
    • Re: NSDictionary, NSTableView and binding
      • From: j o a r <email@hidden>
  • Prev by Date: Re: Threading and NSViews
  • Next by Date: Re: MVC, DBA, CoreData (was: CoreData : fundamental (or not) questions)
  • Previous by thread: Re: Doesn't -sortedArrayUsingDescriptors: use KVC accessors?
  • Next by thread: Re: NSDictionary, NSTableView and binding
  • Index(es):
    • Date
    • Thread