作成した plist からランダムに質問を表示する質問アプリを作りたいです。これが関数です (今のところ 7 つの質問しかありません)。
私の関数はランダムな質問をしますが、常に同じ質問で始まり、質問を繰り返すことができます。質問をランダムに繰り返しなしで生成するには、あなたの助けが必要です.
currentQuestion=rand()%7;
NSDictionary *nextQuestion = [self.questions objectAtIndex:currentQuestion];
self.answer = [nextQuestion objectForKey:@"questionAnswer"];
self.qlabel.text = [nextQuestion objectForKey:@"questionTitle"];
self.lanswer1.text = [nextQuestion objectForKey:@"A"];
self.lanswer2.text = [nextQuestion objectForKey:@"B"];
self.lanswer3.text = [nextQuestion objectForKey:@"C"];
self.lanswer4.text = [nextQuestion objectForKey:@"D"];