我想提出一個問題應用程序,它顯示了我製作的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"];
嘿Eyasin,我沒有得到你,你爲什麼要我來編輯代碼? – MANN