Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 12-07-2011, 07:20 AM   #1 (permalink)
Registered Member
 
Join Date: Oct 2011
Posts: 79
Jaxen66 is on a distinguished road
Default Everyday i try shuffeling..

Hi, everyone!

I am allmost done with my Quiz app for the danish app store!

i am only missing one thing - how to shuffle my 50 questions..
I have seen alot of threads trying to explain how to do it, but non of these have worked for me. I now i should make every question like a NSArray like this:
NSArray *quizArray = [[NSArray alloc] initWithObjects:
@"Hvor langtid gik der før det hurtigeste mål i superligaen blev scoret?", @"20 sekunder", @"16 sekunder", @"7 sekunder", @"18 sekunder", @"2", nil

Then another question: I want to implement In App Purchases that's releases another 50 new question.

Any help is appriciated!
__________________
Thanks for taking the time to help a newbie
Jaxen66 is offline   Reply With Quote
Old 12-07-2011, 11:44 AM   #2 (permalink)
Registered Member
 
Join Date: Jan 2009
Posts: 280
dapis is on a distinguished road
Default

Quote:
Originally Posted by Jaxen66 View Post
Hi, everyone!

I am allmost done with my Quiz app for the danish app store!

i am only missing one thing - how to shuffle my 50 questions..
I have seen alot of threads trying to explain how to do it, but non of these have worked for me. I now i should make every question like a NSArray like this:
NSArray *quizArray = [[NSArray alloc] initWithObjects:
@"Hvor langtid gik der før det hurtigeste mål i superligaen blev scoret?", @"20 sekunder", @"16 sekunder", @"7 sekunder", @"18 sekunder", @"2", nil

Then another question: I want to implement In App Purchases that's releases another 50 new question.

Any help is appriciated!
Perhaps this will help.
dapis is offline   Reply With Quote
Old 12-11-2011, 08:31 AM   #3 (permalink)
Registered Member
 
Join Date: Oct 2011
Posts: 79
Jaxen66 is on a distinguished road
Default

Quote:
Originally Posted by dapis View Post
Perhaps this will help.
I now tried it but it wont work.
I want it to take lets say 10 questions out of the NSarray where there are 50 questions and then remove them so they not are going to be displayed again before the other 40 have been taking. My NSarray should look like this:

-(void)loadQuiz { 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]; }
__________________
Thanks for taking the time to help a newbie
Jaxen66 is offline   Reply With Quote
Old 12-11-2011, 10:04 AM   #4 (permalink)
Registered Member
 
Join Date: Jan 2009
Posts: 280
dapis is on a distinguished road
Default

Quote:
Originally Posted by Jaxen66 View Post
I now tried it but it wont work.
I want it to take lets say 10 questions out of the NSarray where there are 50 questions and then remove them so they not are going to be displayed again before the other 40 have been taking.
I think your problem may have more to do with how to handle arrays. After you shuffle the array (as indicated in the link), simply use the first ten entries and then remove them from the array.
dapis is offline   Reply With Quote
Old 12-11-2011, 01:26 PM   #5 (permalink)
Registered Member
 
Join Date: Oct 2011
Posts: 79
Jaxen66 is on a distinguished road
Default

Quote:
Originally Posted by dapis View Post
I think your problem may have more to do with how to handle arrays. After you shuffle the array (as indicated in the link), simply use the first ten entries and then remove them from the array.
Thanks, could you give me an example on how it might look?
__________________
Thanks for taking the time to help a newbie
Jaxen66 is offline   Reply With Quote
Old 12-11-2011, 01:49 PM   #6 (permalink)
Registered Member
 
MadChef's Avatar
 
Join Date: Aug 2011
Posts: 72
MadChef is on a distinguished road
Default

Sorry for OT..


MadChef is offline   Reply With Quote
Old 12-11-2011, 03:13 PM   #7 (permalink)
Registered Member
 
Join Date: Oct 2011
Posts: 79
Jaxen66 is on a distinguished road
Default

Quote:
Originally Posted by MadChef View Post
Sorry for OT..


Hahaha lol!! Could anyone please give me an example code on how this should be done right, because i have been struggling with this for a while now..?
__________________
Thanks for taking the time to help a newbie

Last edited by Jaxen66; 12-12-2011 at 04:21 AM.
Jaxen66 is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 407
13 members and 394 guests
7twenty7, AppsBlogger, David-T, Duncan C, EvilElf, HemiMG, heshiming, iekei, LunarMoon, Murphy, sacha1996, Sami Gh, teebee74
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,676
Threads: 94,127
Posts: 402,915
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jleannex55
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 06:44 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0