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 05-04-2009, 12:56 PM   #1 (permalink)
Registered Member
 
Join Date: Feb 2009
Posts: 35
scburns123 is on a distinguished road
Default Image Quiz

Hello All!

I am trying to develop a quiz application however I am not able to figure out how to tie all my ideas together under 1 app - if that makes any sense.

My objective is to create a quiz application that will have a picture and the user is to try and guess an answer from a set of 4 possible choices (i.e. close up picture of a nose of a dog and the users guesses whether its a cat's nose, cow's nose, dog's nose, or pig's nose).

So I am somewhat newer to iPhone programming and as an outline I was thinking I would have to do the following:
- Load the images in an array (understand this)
- Create 4 buttons for users to choose from (understand this)
- Have an image overlay the answer once a button was pressed (not sure how to do this)
- Generate images randomly, while having the correct answer follow (not sure on this either)
- Allow for next and previous function (understand this)

I have followed the quiz tutorial found on this thread (http://www.iphonedevsdk.com/forum/ip...quiz-game.html) and learned quite a bit from it.

Could anyone provide any guidance on how to tie it all together? One of my biggest concerns is making the correct answer pop up when the quiz questions are generating randomly...

Any help would be appreciated, you all are great!

Thanks!
Shawn
scburns123 is offline   Reply With Quote
Old 05-04-2009, 01:09 PM   #2 (permalink)
New Member
 
Join Date: Apr 2009
Posts: 92
iphonedev. is on a distinguished road
Default

make all the images you want and name them easily like dognose.png or something then in your array or plist whatever u use make a string called dognose for the question you want to have a dog nose show up on. Then all you need to do is make a string and get the value of dognose. Make the nsstring @"%@.png",arrayName then set the image to your string, easy enough right? Sorry for being so confusing about it lol.
iphonedev. is offline   Reply With Quote
Old 05-18-2012, 07:12 PM   #3 (permalink)
New User
 
Join Date: May 2012
Posts: 2
RocketBaby is an unknown quantity at this point
Cool

Hi Shaun

Did you manage to finish your code? I am interested in learning from your experience? Sharing (is cool) is much appreciated
Thanks RocketBaby
RocketBaby is offline   Reply With Quote
Old 05-18-2012, 08:45 PM   #4 (permalink)
Registered Member
 
Join Date: Feb 2012
Posts: 31
evilmatt10 is on a distinguished road
Smile

Quote:
Originally Posted by scburns123 View Post
Hello All!

I am trying to develop a quiz application however I am not able to figure out how to tie all my ideas together under 1 app - if that makes any sense.

My objective is to create a quiz application that will have a picture and the user is to try and guess an answer from a set of 4 possible choices (i.e. close up picture of a nose of a dog and the users guesses whether its a cat's nose, cow's nose, dog's nose, or pig's nose).

So I am somewhat newer to iPhone programming and as an outline I was thinking I would have to do the following:
- Load the images in an array (understand this)
- Create 4 buttons for users to choose from (understand this)
- Have an image overlay the answer once a button was pressed (not sure how to do this)
- Generate images randomly, while having the correct answer follow (not sure on this either)
- Allow for next and previous function (understand this)

I have followed the quiz tutorial found on this thread (http://www.iphonedevsdk.com/forum/ip...quiz-game.html) and learned quite a bit from it.

Could anyone provide any guidance on how to tie it all together? One of my biggest concerns is making the correct answer pop up when the quiz questions are generating randomly...

Any help would be appreciated, you all are great!

Thanks!
Shawn
For the image overlay it should look something like this.
.h
Code:
IBOutlet UIImageView *answerimage;
.m
Code:
-(void)viewDidLoad {
answerimage.hidden=TRUE;
}

-(IBAction)answeredcorrectly {
answerimage.hidden=FALSE;
}
I did this free hand something might be wrong. Let me know if you have any
other questions! Ill be glad to help!
evilmatt10 is offline   Reply With Quote
Old 05-18-2012, 10:31 PM   #5 (permalink)
Cocoa Junkie
 
Duncan C's Avatar
 
Join Date: Dec 2008
Location: Northern Virginia
Posts: 6,003
Duncan C has a spectacular aura about
Default

Quote:
Originally Posted by scburns123 View Post
Hello All!

I am trying to develop a quiz application however I am not able to figure out how to tie all my ideas together under 1 app - if that makes any sense.

My objective is to create a quiz application that will have a picture and the user is to try and guess an answer from a set of 4 possible choices (i.e. close up picture of a nose of a dog and the users guesses whether its a cat's nose, cow's nose, dog's nose, or pig's nose).

So I am somewhat newer to iPhone programming and as an outline I was thinking I would have to do the following:
- Load the images in an array (understand this)
- Create 4 buttons for users to choose from (understand this)
- Have an image overlay the answer once a button was pressed (not sure how to do this)
- Generate images randomly, while having the correct answer follow (not sure on this either)
- Allow for next and previous function (understand this)

I have followed the quiz tutorial found on this thread (http://www.iphonedevsdk.com/forum/ip...quiz-game.html) and learned quite a bit from it.

Could anyone provide any guidance on how to tie it all together? One of my biggest concerns is making the correct answer pop up when the quiz questions are generating randomly...

Any help would be appreciated, you all are great!

Thanks!
Shawn
Here's what I would do:

Design a dictionary structure that contains the different fields of a quiz question.

Define key/value pairs for the different things you need to store for each question:



an NSString with an image name
an array of possible answer strings
an integer correct answer index

Create an array to hold these question dictionaries, and create one question dictionary through code. Save the array with the one dictionary to disk using the NSArray method writeToFile:atomically: Make the suffix of the file be ".plist" (e.g. "questions.plist")

Save the questions.plist file to your apps's documents directory, and have the code log the full path to the console. Run the program on the simulator. Copy the path name into the clipboard, and then select that file in the finder and drag it into your project.

Once the questions.plist file is in your project, click on it to open it. Copy the dictionary object and then paste it, to create multiple entries in your questions array. Edit them to contain your questions. Save the plist changes.

Next, write code that loads the array into memory in your quiz view controller. When it's time to display a question, take the filename for the image, build a path to the file, and load it into your image view. Load the possible answer strings and install them into labels, or buttons titles, or however you want to display the choices. When the user makes a selection, compare it against the correct answer index.
__________________
Regards,

Duncan C
WareTo

Check out our apps in the Apple App store


Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.

See this tutorial on using UIView animations and layer animations:

See this thread on generating random, non-repeating text

Check out a very cool Macintosh Kaleidoscopes app called ScopeWorks that we released to the Mac App store.
Duncan C is offline   Reply With Quote
Reply

Bookmarks

Tags
array, image, quiz, random

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: 318
8 members and 310 guests
blueorb, givensur, guusleijsten, jbro, mer10, n00b, SLIC, yomo710
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,649
Threads: 94,113
Posts: 402,880
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Anwerbl
Powered by vBadvanced CMPS v3.1.0

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