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

View Single Post
Old 01-04-2010, 05:16 PM   #17 (permalink)
wilky94
Registered Member
 
wilky94's Avatar
 
Join Date: Dec 2009
Location: Seaham UK
Age: 17
Posts: 257
wilky94 is on a distinguished road
Send a message via AIM to wilky94 Send a message via Skype™ to wilky94
Default

Quote:
Originally Posted by rocotilos View Post
Hi. Maybe u can do it like this:

Code:
- (IBAction)A:(UIButton *)sender {
    
	
	if ([question.text isEqualToString:@"What was the first programmable computer called?"]) {
		
		score.text = [NSString stringWithFormat:@"%i", ([score.text intValue] - 1)];	
		
		result.text = @"Incorrect";

                return;  
	}		
	
	result.text = @"Correct";
	
	score.text = [NSString stringWithFormat:@"%i", ([score.text intValue] + 1)];
	
	NSLog(question.text);
	
}
So if the result is wrong, it would deduct 1 point from score and exit the method (using return). Then all the green code is ignored. If it is right, the if statement is ignored, and the green code is executed. I probably use a complete if..else statement.. but im not sure how ur game work. Give the above code a try.
now it is not adding 2 but still adding 1 instead of taking away 1.
wilky94 is offline   Reply With Quote
 

» Advertisements
» Stats
Members: 175,422
Threads: 94,020
Posts: 402,548
Top Poster: BrianSlick (7,978)
Welcome to our newest member, iAppDeveloper
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 03:02 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.