キーと文字列を含む plist に辞書の配列が保存されています。これらはクイズ アプリの質問と回答です。ランダムな質問を画面に表示していますが、質問の回答をランダムな順序で画面にも表示したいです。どうやってやるの?
質問の参照方法は次のとおりです。
-(void)displayQuestion: (NSDictionary *) Question
{
[questionLabel setText:[Question objectForKey:@"Question"]];
[answer1 setText:[Question objectForKey:@"Answer1"]];
[answer2 setText:[Question objectForKey:@"Answer2"]];
[answer3 setText:[Question objectForKey:@"Answer3"]];
}
<dict>
<key>category</key>
<string>Elementary Pilot</string>
<key>Question</key>
<string>You are approaching a hang glider head-on and at approximately the same height. You should:</string>
<key>Answer1</key>
<string>Turn to your right?</string>
<key>Answer2</key>
<string>Turn to your left?</string>
<key>Answer3</key>
<string>Lose height rapidly?</string>
</dict>