NSDictionary, NSTableView and binding
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