我将此 plist 创建为字典,以将书名作为键:
<dict>
<key>Frankestein</key>
<dict>
<key>0</key>
<string>his name was frank</string>
<key>1</key>
<string>he was a monster</string>
</dict>
<key>dracula</key>
<dict>
<key>0</key>
<string>his name was dracula</string>
<key>1</key>
<string>he was a vampire</string>
</dict>
</dict>
</plist>
然后将 plist 加载到字典中:
NSDictionary *plisttext2 = [NSDictionary dictionaryWithContentsOfFile:@"text2.plist"];
我如何能够从字典中生成和显示随机句子,并显示句子编号和书名(键)?
谢谢你的帮助!!