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-02-2010, 07:26 AM   #13 (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 have checked that all the questions are the same. this is all the code i have.

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

	
		
			
	
}

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

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

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

- (IBAction)back:(UIButton *)sender {
	
	[self dismissModalViewControllerAnimated:YES];
	}



- (IBAction)next:(UIButton *)sender {
	question.text = @"What was the first programmable computer called?";
	
	answerA.text = @"ZX";
	answerB.text = @"Z1";
	answerC.text = @"ZZ";
	answerD.text = @"Z0";
	number.text = @"2";
Hi.. I think I may have guessed at what is wrong (or not wrong rather).

I see you are adding the score before the if statement (see the Red fonts i highlighted above). I think the question is detected, but since u are +1 to the score before the if statement, so after the IF STATEMENT is TRUE, it would -1 to score again which sums up to, 0. So no changes in the score was made.

I may be wrong though.. Is that line correct? Seems a bit weird for me.
rocotilos is offline   Reply With Quote
 

» Advertisements
» Online Users: 618
17 members and 601 guests
ADY, baja_yu, David-T, Davor, dcool, delldd, iAppDeveloper, ibrahimadnan, jstonebrook, MaestroApps, mer10, mtl_tech_guy, pipposanta, Sami Gh, SLIC, Steve Shanks, Xaphann
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,422
Threads: 94,020
Posts: 402,547
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:46 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.