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-03-2010, 10:25 AM   #16 (permalink)
rocotilos
almostfunnydev
iPhone Dev SDK Supporter
 
rocotilos's Avatar
 
Join Date: Oct 2009
Age: 34
Posts: 3,015
rocotilos is on a distinguished road
Default

Quote:
Originally Posted by wilky94 View Post
i dont get errors but i think you are correct do you know what i could do to fix this
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.
rocotilos is offline   Reply With Quote
 

» Advertisements
» Online Users: 631
19 members and 612 guests
ADY, baja_yu, bignoggins, checkright, Davor, delldd, estherkt98, iAppDeveloper, ibrahimadnan, jbro, jstonebrook, MaestroApps, Nobbsy, PixelEnvision, Pluvius, pranjalmahna, SLIC, Steve Shanks, TheStalker
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» 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 02:54 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.