An application’s preferences are stored in
an Extended Markup Language (XML) file called Root.plist. Root.plist is
stored in a bundle called Settings.bundle. A settings bundle is not
automatically added to your project, and so you must add it to your
application if you want to use the Settings application (Figure 1). In addition to Root.plist, a settings bundle can contain
any additional .plist files, any images used for sliders, and one or
more .lproj files. Additional .plist files are for any child preference
panes your application might require. The .lproj files are for localized
string resources . You can also store 16 ×
16 pixel images you might want to use as the minimumImage and
maximumImage on a slider pane in your preference panes.
Note
You can also specify an icon for your application in
the Settings application. Create a 29 × 29 pixel Portable Network
Graphics (PNG) image and name it Icon-Settings.png. This file should be placed in your Xcode project’s Resources folder in Groups & Files.
Create a new View-based Application named MySettings.
Expand
the Resources folder and add a new resource file of type Settings
Bundle. Accept the default name. Select the Resources group as the place
to add the Settings.bundle.
Expand Settings.bundle and click Root.plist (Figure 1).
(You may need to display the Utilities pane and change the type of
Settings.bundle to Directory instead of Bundle in order to see a
disclosure triangle next to it so that you can expand it and select Root
.plist.)
Click
Run. Tap the Home button to end the application, and tap the Settings
application’s icon. The Settings application includes MySettings (Figure 2). Tap the arrow, and Settings displays the MySettings application’s default settings screen (Figure 3).
Note
To change this example’s title displayed in Settings,
change the application’s Bundle Display Name in the
MySettings-Info.plist file (Figure 4).