我在Xcode中创建了以下属性列表(.plist)文件。 它是一个共享应用程序组监视设置包。
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ApplicationGroupContainerIdentifier</key>
<string>group.com....</string>
<key>StringsTable</key>
<string>Root</string>
<key>PreferenceSpecifiers</key>
<array>
<dict>
<key>Type</key>
<string>PSMultiValueSpecifier</string>
<key>Title</key>
<string>Primary Colors</string>
<key>key</key>
<string>primColors</string>
<key>DefaultValue</key>
<string>Black</string>
<key>Values</key>
<array>
<string>Black</string>
<string>White</string>
<string>Blue</string>
<string>Red</string>
<string>Yellow</string>
<string>...</string>
</array>
<key>Titles</key>
<array>
<string>Black</string>
<string>White</string>
<string>Blue</string>
<string>Red</string>
<string>Yellow</string>
<string>...</string>
</array>
<key>Key</key>
<string>primColors_preference</string>
</dict>
<dict>
<key>Type</key>
<string>PSMultiValueSpecifier</string>
<key>Title</key>
<string>Secondary Colors</string>
<key>key</key>
<string>secColors</string>
<key>DefaultValue</key>
<string>White</string>
<key>Values</key>
<array>
<string>Black</string>
<string>White</string>
<string>Blue</string>
<string>Red</string>
<string>Yellow</string>
<string>...</string>
</array>
<key>Titles</key>
<array>
<string>Black</string>
<string>White</string>
<string>Blue</string>
<string>Red</string>
<string>Yellow</string>
<string>...</string>
</array>
<key>Key</key>
<string>secColor_preference</string>
</dict>
</array>
</dict>
</plist>
如你所见,我有两个多值元素,原色和二级色(将是一长串颜色)。每个设置都有两个数组,一个用于标题键,另一个用于值键。
在我的情况下,您可以看到这些标题和值数组将完全相同。总共我有四个数组,这种方式完全相同。如果有可能我如何创建一个主阵列(我可以调整)并在其他阵列中重用它?
我希望这样,当我修改主数组时,其他数组也将被修改。