views:

152

answers:

1

I set the text field to bind with a values controller key, a keypath of spacesPerTab, and setting 4 as the placeholder values. But when executing it, the text field displays nothing.

This works for checkboxes.

+1  A: 

The null-placeholder field isn't the correct place to set a default value. It only sets what value will be displayed to the user if no value is set; nothing on the back end will see it.

To truly set a default value, send the standard user defaults object a registerDefaults: message early on in your application. You'll pass a dictionary that contains all of your default values.

You may want to write the dictionary in a plist file, using Xcode or Property List Editor, and bundle it into your application and read it at run time. That will make the code that registers the defaults easier to read for not having a giant hard-coded dictionary in the way.

Peter Hosey