Application Setting in iPhone

mzlgmayptpa

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.

Comments 6

  1. Hi!
    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.

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

  3. Thanks,
    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:
    kFirstNameKey,kLastNameKey,kNameColorKey,kBackgroundColorKey,
    why?
    please help in fixing this error

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">