Application Setting In iPhone

In this application we will see how to  display your app’s preferences or settings in the “Settings” system application.  A settings bundle, included in your application’s bundle directory, contains the information needed by the Settings application to display your preferences and make it possible for the user to modify them.

Step 1: Create a Window base application using template. Give the name of the application “ApplicationSetting”.

Step 2: Xcode automatically creates the directory structure and adds essential frameworks to it. You can explore the directory structure to check out the content of the directory.

Step 3: Now we’ll add table view controller class to the project. Choose New file -> Select cocoa touch classes group and then select UITableViewController subclass. Give the name “ApplicationSettingViewController”.

Step 4: In our application we need to add Settings.bundle , so select ApplicationSetting -> Add -> New File -> Resources -> Setting Bundle , and give the name settings. Then your will see there are two things are created , 1. Root.plist, 2. Root.strings.

Step 5: In the AppDelegate.h file, we will impliment the NavigationController in the file. Make the following changes in the file.




Step 6: Make the following changes in the AppDelegate.m file.




Step 7: In the settings.bundle , we’ll see .plist where all the informations are already set what we want to display.

Step 8: In the ApplicationSettingViewController.h file make the following changes.




Step 9: Double click the MainWindow.xib file , and open it to the Interface Builder. Drag Navigation Controller from the library and place it to the main window. Open the Navigation controller, drag table view from the library and place it to the navigation window. Now select view controller and bring up Identity Inspector change the class name into the ApplicationSettingViewController. Drag view from the library and place it to the main window change the name into intructionsView. Now drag Bar Button Item from the library and place it on the mainwindow. Connect the Application Setting App Delegate to the Navigation Controller.  Now save the MainWindow.xib file and go back to the Xcode.

Step 10: Now make the following changes in the ApplicationSettingViewController.m file.




Step 11: Now compile and run the application in the Simulator.

Leave a Comment:

loc pham says January 11, 2011

I have followed your sample but ended up with 21 compiled errors mostly:
‘ApplicationSettingAppDelegate’ undeclared (first use in this function)

‘appDelegate’ undeclared (first use in this function)

/ ‘blackBackColor’ undeclared (first use in this function)

‘whiteBackColor’ undeclared (first use in this function)

‘blueBackColor’ undeclared (first use in this function)

‘patternBackColor’ undeclared (first use in this function)

‘ApplicationSettingAppDelegate’ undeclared (first use in this function)

Could you please be more specific with step 9 ? Is there anyway I can download your source code ? Thank you.

Eric says January 11, 2011

kFirstNameKey was unrecognised, as was kLastNameKey, kNameColorKey, kBackgroundColorKey also no @synthesise or methods for properties–among other issues.

Imran Pariyani says March 9, 2011

Thanks for the tutorial .. is it possible for you to upload the source code for to app somewhere?

Alok says April 7, 2011

i have implemented your code,i am getting errors in all the keys you have declared.Means compiler says following keys are not declared. for ex:
please help in fixing this error

Nida says June 1, 2011

Its very useful tutorial, Please upload the source code as. Thanks

Jaimin Modi says January 2, 2013

Please upload your source code in xcode 4.2.5 i didn’t get a way to create this settings bundle.

Add Your Reply