iPhone Preferences - Easy as 1-2-3

Thursday, May 21, 2009

iCityTech Preferences

Today, I started my first task for the CityTech iPhone application - the preferences pane.  Surprisingly, this was a very easy.  Here are the first few steps:

1)  Open your project in Xcode
2)  Create a new File
3)  Choose “Resource” from the iPhone section
4)  Choose “Settings Bundle”

This creates your settings page and links it to the Settings app on the iPhone.  Additionally, the copied Settings.bundle file has some example preferences already included.  Click the “Build and Go” button to launch the iPhone emulator.  Hit the home button on the emulator and launch the Settings app.  Click your app from the list and you are good to go.  Exit the iPhone Emulator with command-Q.

To modify your preferences, open the tree for “Preference Items.”  Our tree  has five items.  The first item, of type “Group” groups the following four items together on the preferences page.  After that, I just added my four text fields using the + sign on the right side of the table.  For each item you can set:
* Type (TextField, Slider, etc)
* Default Value
* Title (the question)
* Keyboard Type
* Secure (for passwords)
* Identifier (how your app will reference this field)

XCode Modify App PreferencesThe only thing I had trouble with was moving the items once I added them.  Originally I added password at the top and couldn’t figure out how to move it to the bottom.  A simple drag of the mouse didn’t help.  I ended up deleting the line and adding a new one at the bottom.

For more detailed information, read the “Application Preferences” section in Chapter 9 of Apple’s “iPhone App Programming Guide”

Loose project plan
———————————–
Step one - design app.           [done]
Step two - break ground.        [done]
Step three - setup backend.  [done]
Step four - code app
a) Preferences                       [done]
b) Web service calls
c) Search
d) Results
e) Viewer
Step five - test app
Step six - package app
Step seven - submit to apple for approval

Top