• 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
Master-Detail binding in User Defaults
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Master-Detail binding in User Defaults


  • Subject: Master-Detail binding in User Defaults
  • From: Steve Nicholson <email@hidden>
  • Date: Tue, 22 Apr 2008 17:47:42 -0700

I'm trying to set up a Master-Detail binding with User Defaults under OS X 10.4.11. It is correctly reading values I manually put into the Preferences file. I can select different items in the table and the detail items display the correct information, but no changes are written to the file. If I add an item to the array (using a button connected to the NSArrayController's insert: action), an item is added to the table. I can edit the name of the item in the table and change its details and see those changes if I select another table item the select the new one again, but when I quit my program and look at the preferences file, an empty dictionary has been added to the array.

I also have "normal" preference items in the same window that work fine.

Is there something I'm doing wrong or is this just not a supported usage?

Here's the setup in Interface Builder:

NSArrayController:
	Name: Variables
	Object class Name: NSMutableDictionary
	contentArray bindings:
		Bind to: Shared User Defaults
		Controller Key: values
		Model Key Path: variables

NSTableColumn value bindings:
	Bind to: Variables (NSArrayController)
	Controller Key: arrangedObjects
	Model Key Path: name

NSPopUpButton selectedIndex bindings:
	Bind to: Variables (NSArrayController)
	Controller key: selection
	Model Key Path: lineWidth

NSPopUpButton selectedIndex bindings:
	Bind to: Variables (NSArrayController)
	Controller key: selection
	Model Key Path: lineSymbol

Relevant contents of Preferences file (the second array element is an empty dictionary that was inserted with the NSArrayController's insert: action):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http:// www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>variables</key>
<array>
<dict>
<key>lineSymbol</key>
<integer>8</integer>
<key>lineWidth</key>
<integer>2</integer>
<key>name</key>
<string>R</string>
</dict>
<dict/>
<dict>
<key>lineSymbol</key>
<integer>1</integer>
<key>lineWidth</key>
<integer>1</integer>
<key>name</key>
<string>PRES</string>
</dict>
<dict>
<key>lineSymbol</key>
<integer>12</integer>
<key>lineWidth</key>
<integer>3</integer>
<key>name</key>
<string>RHO</string>
</dict>
</array>
</dict>
</plist>


_______________________________________________

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


  • Prev by Date: Re: NSString memory management question
  • Next by Date: Re: NSString memory management question
  • Previous by thread: Re: [ANN] TransactionKit, Lockless Multi-Reader, Multi-Writer Transaction Capable Hash Tables
  • Next by thread: "Safe" frameworks for privileged tools?
  • Index(es):
    • Date
    • Thread