Small game

The application does the following:

• When the user the user clicks the Spin button three colors are randomly selected and displayed.

• If all three colors are the same the user wins and a message is displayed otherwise the user loses and a corresponding message is displayed.

• A count of the wins is displayed.

• A count of the losses is displayed.

See the screenshot at the bottom.

Other requirements:

• Use labels and set the background color for the color blocks.

• Define and use a method that takes two parameters, a label object and a color. The method sets the label's background color to the specified color.



• Create instance variables for the GUI items in the interface file.

• Create properties for the instance variables in the interface file.

• Synthesize the properties for the instance variables in the implementation file.

• In Interface Builder drag the GUI items you will use into the UIWindow instance window.

• Compile and run. Don't forget to save in Interface Builder.


• Declare the action method for the button.

• Define the action method for the button. Put a console output message in the method.

• Make connections from the Connections tab in the Inspector, or right click on the AppDelegate in the "Doc" window, to the correspoding GUI item.

• Make the target/action connection for the button.

• Compile and run. Make sure the button presses call the button method.


• Add the remaining functionality.

• Do initialization in the method provided when the project was created:

• - (BOOL) application:(UIApplication *)application

• didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

Additional Notes

Remember inheritance, if a method or property isn't defined in an object's class it might come from a parent class.

If a label is never modified it does not need an instance variable.

What would cause the following error message?

Error: Cannot use object as a parameter.

Some Code

Some code that might be useful:

// Console output


NSLog(@"Message %@", nsString);

// Create colors

[UIColor colorWithRed: 0.9 green: 0.9 blue: 0.6 alpha: 1.0]

// Create a string from an int

[NSString stringWithFormat:@"%d", int_num]

// Include for random functions: #include <stdlib.h>

// Set the random number generator seed from the system clock.

time_t seed = time(0);


// Get a random value

int num = rand() % 3

Skills: Cocoa, iPhone, Objective C

See more: stdlib string, h game, define user interface, in cocoa, get the label, a&t labels, seed, need to put a label, game gui, game background, d game project, bool, at labels, click random game, generator screenshot, gui small project, game drag, call action message, loses, object background, project inheritance, save drag, seed random number generator, call method, generator seed

About the Employer:
( 2 reviews ) Cleveland, United States

Project ID: #1101922

Awarded to:


Considered done. Kindly check PMB.

$80 USD in 1 day
(42 Reviews)

4 freelancers are bidding on average $93 for this job


Hi, Please check PM.

$150 USD in 2 days
(59 Reviews)

Hi.. Please check PM for details..

$90 USD in 2 days
(3 Reviews)

I can do this project. Bid me :D

$50 USD in 3 days
(0 Reviews)