• 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
NSTableView, IB & NSUserDefaults
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSTableView, IB & NSUserDefaults


  • Subject: NSTableView, IB & NSUserDefaults
  • From: Chris Heimark <email@hidden>
  • Date: Mon, 19 Nov 2007 18:15:32 -0500

I have struggled some days now - searching the archives, playing with examples and googling - to figure out how to get an NSTableView to place nicely with a full dictionary entry in the user defaults.

I can get an NSTableView to load an entire dictionary from the user bundle and display it properly by using the informal protocol methods:

- (id)tableView:(NSTableView *)aTableView
    objectValueForTableColumn:(NSTableColumn *)aTableColumn
			row:(int)rowIndex;
- (int)numberOfRowsInTableView:(NSTableView *)aTableView;

But what I really want is to be able to have a relatively small number of rows (maybe 10 max) to be completely editable, without adding much if any code, by leveraging user defaults binding.

I am fairly sure my difficulty lies in the way I am setting up the IB entries for my NSTableView. For example, if I have the following dictionary as my example:

<plist version="1.0">
<dict>
<key>records</key>
<array>
	<dict>
		<key>number</key>
		<integer>97</integer>
		<key>place</key>
		<string>Superior Road</string>
	</dict>
	<dict>
		<key>number</key>
		<string>123</string>
		<key>place</key>
		<string>Main Street</string>
	</dict>
</array>
</dict>
</plist>

Then when I have the two column bindings for number & place setup as 'values.number [Shared User Defaults]' and 'values.place [Shared User Defaults]' ... I can get the values to show up as root values in the defaults plist. And the plist ends up looking like this:

<plist version="1.0">
<dict>
	<key>number</key>
	<integer>97</integer>
	<key>place</key>
	<string>Superior Road</string>
</dict>
</plist>

And every row will look the same. However, I am led to logically believe that if I also setup the table content bindings entry as 'values.records [Shared User Defaults]', the table view will magically know how to construct the right intersection of data rows/ columns and maintain an entire row/column dictionary for me.

Can anyone shed some light on this darkness for me? What little tidbit am I missing? Is there some magic to naming of binding entries so the right intersection of row&columns occurs?

Thanks in advance.

Chris
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: NSTableView, IB & NSUserDefaults
      • From: Chris Heimark <email@hidden>
  • Prev by Date: NSAnimation crashing on Leopard;
  • Next by Date: Re: Restoring sort order to NSTableView
  • Previous by thread: Re: NSAnimation crashing on Leopard;
  • Next by thread: Re: NSTableView, IB & NSUserDefaults
  • Index(es):
    • Date
    • Thread