Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Hour 12. Working with User Defaults > Binding to the User Defaults Controller

Binding to the User Defaults Controller

In the previous section, you saw how you can programmatically set and query user default values to allow users to customize and configure your application.

If you want the user to be able to edit these preferences, there is an easier way of doing so other than manually copying values from text fields into the user defaults object and back again.

The NSUserDefaultsController class is a bindings-aware class that you can use to provide a binding target for UI elements so they can be bound to user preferences. Remember that bindings work for more than just simple input fields. For example, you could bind the color of a view to the user’s favorite color.

To bind a value to the user defaults controller, open up the bindings inspector of whatever control you’re working with. When you choose to bind, one of the options for a binding target is called Shared User Defaults Controller.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial