IT tutorials
 
Mobile
 

iOS SDK : Application Settings - The Settings Bundle (part 3) - PSMultiValueSpecifier

5/3/2013 9:03:40 PM
- How To Install Windows Server 2012 On VirtualBox
- How To Bypass Torrent Connection Blocking By Your ISP
- How To Install Actual Facebook App On Kindle Fire

3. PSMultiValueSpecifier

The PSMultiValueSpecifier is for selecting one of many alternative choices. Table 3 summarizes the PSMultiValueSpecifier’s settings. Note that you create entries below the Values and Titles settings for each value and for each title.

Table 3. PSMultiValueSpecifier Settings
KeyPurposeTypeValid ValuesRequired
TypeSpecifies preference type.StringPSMultiValueSpecifierYes
TitleSpecifies the title displayed by the Settings application.StringAny string valueYes
KeySpecifies the preference’s key used for storage and retrieval.StringAny string valueYes
ValuesSpecifies an array of values.ArrayArray of Key-Value entriesYes
TitlesSpecifies titles for array of values.ArrayArray of Key-Value entriesYes
Default ValueSpecifies a default value for the preference.AnyAny value from the Values arrayYes

Try This: Adding a PSMultiValueSpecifier

  1. Return to MySettings in Xcode. Open the Root.plist in the editor.

  2. Create an Item 2 below PreferenceSpecifiers and ensure its type is Dictionary.

  3. Expand Item 2 and add six new child rows.

  4. Change the first child row to have Type for the key, String for the type, and PSMultiValueSpecifier for the value (Figure 7).

    Figure 7. Root.plist with the PSMultiValueSpecifier added
  5. Change the next child row to have Title for the key, String for the type, and Colors for the value.

  6. Change the next child row to have DefaultValue for the key, String for the type, and blue for the value.

  7. Change the next child row to have Key for the key, String for the type, and keyTwo for the value.

  8. Change the next two child rows to have Titles and then Values for the key and Array for the type.

  9. Expand Titles and then add three child rows to it. Do the same for Values (see Figure 7). Assign the three child Titles the values Red, Blue, and Orange. Assign the three child Values the values red, blue, and orange.

  10. Save the .plist file.

  11. Click Run. Navigate to the Settings application, and the new setting appears (Figure 8).

    Figure 8. Settings reflecting the new setting

4. PSToggleSwitchSpecifier

The PSToggleSwitchSpecifier is for selecting a Boolean value. The toggle switch displayed in the Settings application for this specifier is On or Off. Table 4 summarizes the PSToggleSwitchSpecifier’s settings.

Table 4. PSToggleSwitchSpecifier Settings
KeyPurposeTypeValid ValuesRequired
TypeSpecifies preference type.StringPSToggleSwitchSpecifierYes
TitleSpecifies the title displayed by the Settings application.StringAny string valueYes
KeySpecifies the preference’s key used for storage and retrieval.StringAny string valueYes
TrueValueThe value for on.AnyAny scaler type, including Boolean, String, Number, or Data. Default is BooleanNo
FalseValueThe value for off.AnyAny scaler type, including Boolean, String, Number, or Data. Default is BooleanNo
DefaultValueSpecifies a default value for the preference.AnyString value from TrueValue or FalseValueYes

Try This: Adding a PSToggleSwitchSpecifier

  1. Return to Root.plist and add Item 3 below PreferenceSpecifiers (i.e., highlight Item 2 and click the plus sign on the right). Change the new item’s type to Dictionary.

  2. Expand Item 3 and add six new child rows. Change the first child row to have a Type for key, String for type, and PSToggleSwitchSpecifier for value. Change the second child row to have Title for key, String for type, and Use Colors? for the value. Change the third child row to have Key for key, String for type, and keyThree for value. Change the fourth child row to have TrueValue for key, String for type, and YES for value. Change the fifth child row to have FalseValue for key, String for type, and NO for value. Finally, change the sixth child row to have DefaultValue for key, String for type, and NO for value (Figure 9).

    Figure 9. Root.plist with the PSToggleSwitchSpecifier added
  3. Save the .plist file.

  4. Click Run. Navigate to Settings, and the new value appears (Figure 10).

    Figure 10. Settings reflecting the new setting

Note

Notice we keep stating to “save the .plist file” as its own step. The reason for this is that Run does not automatically save the .plist file.
 
Others
 
- iOS SDK : Application Settings - The Settings Bundle (part 2) - Settings Field Types
- iOS SDK : Application Settings - The Settings Bundle (part 1)
- Ipad : Your Calendar - Calendar Options - Changing the Default Calendar
- Ipad : Your Calendar - Editing Appointments, Meeting Invitations
- BlackBerry Bold 9700 and 9650 Series : Email Set Up - BlackBerry Enterprise Server Express
- BlackBerry Bold 9700 and 9650 Series : Email Set Up - Set Up or Adjust Email Accounts from Your Computer
- BlackBerry Bold 9700 and 9650 Series : Email Set Up - Troubleshooting Your Email Accounts
- Windows Phone 7 : Building 2D Games with the XNA Framework (part 2) - AlienShooter Game Structure
- Windows Phone 7 : Building 2D Games with the XNA Framework (part 1)
- Android Application Development : Signing and Publishing Your Application (part 2)
 
25 Inspiring Game of Thrones Quotes
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
programming4us programming4us
 
Popular tags
 
Video Tutorail Microsoft Access Microsoft Excel Microsoft OneNote Microsoft PowerPoint Microsoft Project Microsoft Visio Microsoft Word Active Directory Biztalk Exchange Server Microsoft LynC Server Microsoft Dynamic Sharepoint Sql Server Windows Server 2008 Windows Server 2012 Windows 7 Windows 8 Adobe Indesign Adobe Flash Professional Dreamweaver Adobe Illustrator Adobe After Effects Adobe Photoshop Adobe Fireworks Adobe Flash Catalyst Corel Painter X CorelDRAW X5 CorelDraw 10 QuarkXPress 8 windows Phone 7 windows Phone 8 BlackBerry Android Ipad Iphone iOS