Search code examples
iosiphoneobjective-cinappsettingskit

Retrieve the title of a stored plist value from localized .strings


What is the best method to retrieve the title for the stored Root.plist value located inside Root.strings ? For example I have stored an INT = 1 which has a key of MUL_VAL_2 that corresponds to "Female Voice" in Root.strings. How can I retrieve "Female Voice" for the stored INT?

 // Root.strings     
 "MUL_VALUE_TITLE"       = "Multiple Values";
 "MUL_VAL"               = "Sound Theme";
 "MUL_VAL_1"             = "Male Voice";
 "MUL_VAL_2"             = "Female Voice";
 "MUL_VAL_3"             = "Mechanical";


 // Root.plist
 <plist version="1.0">
 <dict>
<key>Titles</key>
<array>
    <string>MUL_VAL_1</string>
    <string>MUL_VAL_2</string>
    <string>MUL_VAL_3</string>
</array>
<key>Type</key>
<string>PSMultiValueSpecifier</string>
<key>Values</key>
<array>
    <integer>0</integer>
    <integer>1</integer>
    <integer>2</integer>
</array>
<key>Title</key>
<string>MUL_VAL</string>
<key>Key</key>
<string>timer_theme_mulValue</string>
<key>DefaultValue</key>
<integer>0</integer>
</dict>


Solution

  • You can use IASK's own logic to retrieve the localized string:

    [settingsViewController.settingsReader titleForStringId:@"MUL_VAL_1"]