I’m still quite new at iPhone/Xcode development. I made one app so far that got published on the app store but it was a simple game. So please bear with me.
Now I am trying to create an app that will basically be like a multiple choice test. I was thinking it would go like this:
- Show question 1 and choices 1
- user picks answer
- check if user’s answer is same as question 1 answer
- show question 2 and choices 2
etc.
What is usually the best way to do this? Do I create an array that has the “question, choices and answer key” in each slot then load them onto the screen one by one? Is that even possible? Can I have three values in a single array slot?
Thanks for your help. Any input would be appreciated.
You should use a NSMutableArray filled with separate NSDictionaries contains bunch of question and its answer. Each new question and answer is to be stored into the NSDictionary and that NSDictionary will going to add into the NSMutableArray. According to the next level of game, you can have get the new question and answer in memory in form of NSDictionary from the index of NSMutableArray.
i.e.
So on you may add all questions along with answers.
Is it clear to you?