有没有办法从源代码中添加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">
<array>
<dict>
<key>title</key>
<string>Title 1</string>
//here i want to add one more string(value) how to do so?
<key>subtitle</key>
<string>Subtitle 1</string>
<key>image</key>
<string>image1.png</string>
</dict>
我在plist中想要的是......
Key
Type
Value
value
value
<?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">
<array>
<dict>
<key>title</key>
<string> 1</string>
<string> 2 </string>
<string> 3</string>
</dict>
</Plist>
答案 0 :(得分:5)
不幸的是,词典使用Key / Value范例,这意味着给定键只有一个值。但是您可以设置包含两个字符串的数组,例如:
<key>title</key>
<array>
<string>Title 1</string>
<string>Title 2</string>
</array>