Chapter 13. User Defaults

Many applications have Preferences panels that allow the user to choose a preferred appearance or behavior. The user’s choices go into the user defaults database in the user’s home directory. Note that only the choices that vary from the factory defaults are saved in the user defaults database. If you go to ~/Library/Preferences, you can see your user defaults database. The files are in a binary format, but you can use Xcode’s property list editor to browse though them.

The NSUserDefaults class allows your application to register the factory defaults, save the user’s preferences, and read previously saved user preferences.

The color well that you dropped into the Preferences window in the previous chapter will determine ...

Get Cocoa® Programming for Mac® OS X, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.