Defining keywords for dynamic configuration values
For all string type values in the MyConfiguration.plist configuration file, you can specify special keywords in the value string to cause the app to find the value in string resources or in settings. This task demonstrates specifying the title and icon for a custom menu item in the app's sidebar menu.
Procedure
Example: defining a custom menu item
The following example demonstrates deining a custom menu item.
- In the app file
Localizable.strings, we defined these string resources.
"my_menuitem_icon1_filename" = "test_menuitem_icon1.png"; "my_menuitem_icon1selected_filename" = "test_menuitem_icon1_active.png";
- In the file MyConfiguration.plist, in the Property List view, find and expand the key labelled CustomMenuItems.
- Add the following entries.
Key Type Value CustomMenuItems Array (2 items) Item 0 Dictionary (4 items) icon String string: my_menuitem_icon1_filename iconSelected String string: my_menuitem_icon1selected_filename title String setting: my_test_menuitem1_title url String http://spotfire.tibco.com <dict> <key>icon</key> <string>string: my_menuitem_icon1_filename</string> <key>iconSelected</key> <string>string: my_menuitem_icon1selected_filename</string> <key>title</key> <string>setting: my_test_menuitem1_title</string> <key>url</key> <string>http://spotfire.tibco.com</string> </dict>
- In the Xcode project navigator, find and open the file DeploymentKitApp/Settings/Settings.bundle/Root.plist.
- In the
Property List view , find the setting Text Field - My Custom Menu Item Title.
Key Type Value Item 19 (Text Field - My Custom Menu Item Title) Dictionary (4 items) Default Value String My Custom Menu Item 1 Identifier String my_test_menuitem1_title Title String My Custom Menu Item Title Type String Text Field <dict> <key>DefaultValue</key> <string>My Custom Menu Item 1</string> <key>Key</key> <string>my_test_menuitem1_title</string> <key>Title</key> <string>My Custom Menu Item Title</string> <key>Type</key> <string>PSTextFieldSpecifier</string> </dict>
Copyright © Cloud Software Group, Inc. ALL RIGHTS RESERVED.