Advertise Books Events Forum News Social Networking Support Us

sdkIQ for iPhone
($4.99)

Shape Up
($0.99)

Your First iPhone App
($1.99)

iVidCam Free
(free)

Kid Art
($0.99)

iPUBQUIZ
(£1.19)

ArtStudio
($3.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 02-09-2010, 12:43 AM   #1 (permalink)
One Man Show
 
rocotilos's Avatar
 
Join Date: Oct 2009
Location: MY
Age: 32
Posts: 1,171
Exclamation animationDidStop not called for 2nd time?

I am making 3 simple animations that has to go in sequence. I want to use the animationDidStop, but so far only able to detect the first animation stop only, not the 2nd and 3rd.

The code:
Code:
-(void) animationDidFinished:(NSString *)animationID finished:(NSNumber *)finished  context:(void *)context {
	
	int num = [finished  intValue];
	
	if ((num==1)&&([animationID isEqualTo:@"TurretAnimate1"])) {
		
	    [UIView beginAnimations: @"TurretAnimate2" context: nil];
		[UIView setAnimationDuration: 0.3];
		[UIView setAnimationCurve: UIViewAnimationCurveEaseInOut];	
                [UIView setAnimationDelegate: self];
		[UIView setAnimationDidStopSelector:@selector(animationDidFinished:finished:context:)];
		theturret.transform = CGAffineTransformMakeRotation(0);
		
		[UIView commitAnimations];	
		accelval.text = [NSString stringWithFormat:@"%.2f", theangle];	
		
	
	}
	
	if ((num==1)&&([animationID isEqualTo:@"TurretAnimate2"])) {
		
	    // do 3rd animation with ID TurretAnimate3
	}
	
if ((num==1)&&([animationID isEqualTo:@"TurretAnimate3"])) {
		
	    // do cleanup
	}
	
	
}

-(void)UpdateTurret {
	
	[UIView beginAnimations: @"TurretAnimate1" context: nil];
	[UIView setAnimationDelegate: self];
	[UIView setAnimationDuration: 0.3];
	[UIView setAnimationCurve: UIViewAnimationCurveEaseInOut];	
	[UIView setAnimationDidStopSelector:@selector(animationDidFinished:finished:context:)];
	
	if (theangle<0) theangle = 0; 
	if (theangle>PIE) theangle = PIE;

	theturret.transform = CGAffineTransformMakeRotation(theangle);

	[UIView commitAnimations];
	
}
Please note that im using 2.2.1, so it is using NSNumber, instead of BOOL for 'finished' parameter.

Thanks
__________________
The iPhone/iPod Touch Apps That I'm Proud Of:
iTronixPal - Most Functional Electronics App | Arkaneum - Space Mancala | Cars.tomizer - Realistic Vehicle Customizer! | AppliFX - Unique Photo FX

Check all my other apps in my website (click below):

Last edited by rocotilos; 02-09-2010 at 02:48 AM.
rocotilos is offline   Reply With Quote
Old 02-09-2010, 02:40 AM   #2 (permalink)
One Man Show
 
rocotilos's Avatar
 
Join Date: Oct 2009
Location: MY
Age: 32
Posts: 1,171
Default

BRAIN FART!

I missed out the delegate on the 2nd animation. (edited above post and highlighted the missing line of code)
__________________
The iPhone/iPod Touch Apps That I'm Proud Of:
iTronixPal - Most Functional Electronics App | Arkaneum - Space Mancala | Cars.tomizer - Realistic Vehicle Customizer! | AppliFX - Unique Photo FX

Check all my other apps in my website (click below):
rocotilos is offline   Reply With Quote
Reply

Bookmarks

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


Enter the iPhone App Challenge!  Win $500!
» Advertisements
» Stats
Members: 23,921
Threads: 38,707
Posts: 169,889
Top Poster: smasher (2,554)
Welcome to our newest member, noisyblue
Powered by vBadvanced CMPS v3.1.0

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