Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 02-09-2010, 01:43 AM   #1 (permalink)
rocotilos
indie dev
 
rocotilos's Avatar
 
Join Date: Oct 2009
Posts: 2,754
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

Last edited by rocotilos; 02-09-2010 at 03:48 AM.
rocotilos is offline   Reply With Quote
 

» Advertisements
» Online Users: 439
20 members and 419 guests
acegames, ADY, BdR, ChenXin, ckgni, Darmanikles, dfvdan, fkmtc, gagack, iph_s, john love, marcelglaeser, MarkC, Naughty_Ottsel, rodrigoK, RoryHarvey, technovelty, thebinaryfamily, zacharyse, zbynda
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,873
Threads: 89,225
Posts: 380,698
Top Poster: BrianSlick (7,129)
Welcome to our newest member, zacharyse
Powered by vBadvanced CMPS v3.1.0

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