Tuesday, February 3, 2009

iPhone Development: Application Preferences Part 2

In this post I will be using PSChildPaneSpecifier in the application preferences.
You should read part 1 of this post if you are not familiar with application preferences. You can find it here .

What does PSChildPaneSpecifier do? It adds another page of configurations into your settings. We do that when we have a large number of configurations, so we divide them into categories and make a child pane of each category. 

A child pane is nothing but another plist file. So to start with, open the same project "MyTestProject", right click on Settings.bundle and select "add new". From the "Other" tab select plist file as shown below:



Name the file as "Child.plist". You will notice that child.plist file is not added in the Settings.bundle. You need to add it inside Settings.bundle which will be done from the terminal.

To do so, open Terminal and navigate to your projects directory. Execute "ls" on shell to cross verify that you are in the correct directory. Following should appear on the Terminal:



Now copy child.plist file into the Settings.bundle by following command: "cp child.plist Settings.bundle". Cross verify by navigating into Settings.bundle directory and executing "ls". child.plist file should show up. 

Close the terminal now and come to xCode again. You will now find child.plist inside Settings.bundle. Double click Child.plist and add items to make it look like this:



We have created the new child plist file, now we need to add a reference to it in the root.plist file. Open root.plist and add 2 new items to make it look like this.



Build and run the application , go to the settings and select your project MyTestProject. It shold look similar to the following:



In next post I am going to access these preferences from the MyTestProject and also allow the user to change them from the View itself.

`
`
`
`
`
`


2 comments:

  1. where is the referred next posting. I could really use it.

    In next post I am going to access these preferences from the MyTestProject and also allow the user to change them from the View itself.

    ReplyDelete
  2. Hi!
    Just wondering when the next posting will be? This is the part I am really stuck on!

    Thanks! :)

    ReplyDelete

Leave your suggestions

There was an error in this gadget