我一直在努力解決如何在我的NSarray中洗牌的問題。我想讓它從NSarray中提出10個問題,其中有50個問題,然後將它們刪除,以便在其他40個問題已經採取之前不會再顯示它們。我的NSarray應該看起來像這樣:隨機測驗問題?
{
NSArray *quizArray = [[NSArray alloc] initWithObjects:
@"How much was David Beckham's deal worth upon signing for LA Galaxy?", @"$250m", @"$32.5m", @"$75m", @"$502m", @"3",
@"In which year did David beckham sign for LA Galaxy?", @"2006", @"2007", @"2008", @"2009", @"2",
@"In 2008, Rice-Eccles Stadium housed which MLS team for their home games?", @"Toronto FC", @"Real Salt Lake", @"Colorado Rapids", @"Houstion Dynamo", @"2",
@"Which of these teams, won the first MLS Cup?", @"Chicago Fire", @"Colorado Rapids", @"DC United", @"LA Galaxy", @"3",
@"Wich of these players have the record for most goals in a game?", @"Mamadou Diallo", @"Marco Etcheverry", @"Cobi Jones", @"Clint Mathis", @"4", nil];
self.theQuiz = quizArray;
[quizArray release];
}
我一直在網上搜索近2周,希望能幫助我一些! :)
我建議將它們分組在一起,而不是將問題和答案添加到同一個數組中。 –
@jakob Pipenbring:你有沒有得到解決方案,如果你得到請分享示例項目 –