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 03-12-2011, 05:09 PM   #1 (permalink)
Registered Member
 
Join Date: Nov 2010
Location: Portugal
Posts: 20
sapateira is on a distinguished road
Question Animation error

Hello guys.

I'm trying to build a memory game. The kind where you turn 2 peaces and have to match 2 images hidden bellow them.

The peaces (buttons) that match have the same tag.

Everything seams to be working well, but there's a small bug when i run the code in the simulator.

- When i press the first peace of the set it always takes 0.5 sec. to fade out
- When i press the second peace, and there's a match between the first one, it also takes 0.5 sec. to fade out
- The problem is when i press the second peace, and there's no match between them... it doesn't fade out! Simply disappears (it should take 0.5 sec. to fade out) and then both peaces fade back in 0.5 sec.

Code:
	- (IBAction)pressGO: (id) sender {
				
		if (pushCTRL == 0) {
			
			pushCTRL = 1;
			idTAG01 = [sender tag];
			
			BTN01 = sender;
			
			[UIView beginAnimations:nil context:NULL];
			[UIView setAnimationDuration:0.5];
			[sender setAlpha:0];
			[UIView setAnimationDelegate:self];
			[UIView commitAnimations];
              
		}
		
		else if (pushCTRL == 1) {
			
			pushCTRL = 0;
			idTAG02 = [sender tag];	
			
			BTN02 = sender;
			
			[UIView beginAnimations:nil context:NULL];
                        [UIView setAnimationDelay:0];
			[UIView setAnimationDuration:0.5];
			[sender setAlpha:0];
			[UIView setAnimationDelegate:self];
			[UIView commitAnimations];
			
			if (idTAG02 != idTAG01) {
				
				[UIView beginAnimations:nil context:NULL];
				[UIView setAnimationDelay:0.5];
				[UIView setAnimationDuration:0.5];
				BTN01.alpha = 1;
				BTN02.alpha = 1;
                                [UIView setAnimationDelay:0.5];
				[UIView setAnimationDelegate:self];
				[UIView commitAnimations];
		
			}
			
		}
		
	}

Last edited by sapateira; 03-13-2011 at 06:03 AM.
sapateira is offline   Reply With Quote
Reply

Bookmarks

Tags
animation, duration, error, pause

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: 366
8 members and 358 guests
Absentia, akphyo, apatsufas, BinHex, fredidf, Kirkout, MarkC, mottdog
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,667
Threads: 94,120
Posts: 402,898
Top Poster: BrianSlick (7,990)
Welcome to our newest member, host number one
Powered by vBadvanced CMPS v3.1.0

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