Immersive applications, such as games, generally should provide their own preferences view so that the user doesn’t need to quit to make a change. You create a property list describing your application’s available settings, and the Settings app creates the interface for you. Your applications use NSUserDefaults to read and store preference data using pairs of keys and values, just as you would access keyed data from a dictionary, the difference being NSUserDefaults data persists to the file system rather than stored in an object instance in memory.īecause the Settings app provides a standard interface, you don’t need to design your own UI for your app’s preferences. If you’ve programmed in Cocoa on macOS, you’re probably already familiar with NSUserDefaults because it’s the same class used to store and read preferences on macOS. In an iOS application, the NSUserDefaults class provides the user defaults service. The Settings app on a typical iPhone display User Defaults stores and retrieves preferences for the application.įigure 1. The Settings application acts as a common user interface for the iOS User Defaults mechanism. The settings bundle contains a group of files built in to an application that tells the Settings application which preferences the application wishes to collect from the user, as shown in Figure 1. The Settings application lets the user enter and change preferences for any application that includes a settings bundle. ![]() Let’s look at how to add settings for your iOS application to the Settings app. ![]() The iPhone and iPad include a dedicated application called Settings that you’ve likely used before. Selecting it brings up a window where the user enters and changes various options. On macOS, you’ll usually find a Preferences… menu item in the application’s menu. All but the simplest apps you’re likely to use typically include a preferences window where the user sets application-specific options.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |