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 > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 02-09-2010, 01:43 AM   #1 (permalink)
indie dev
 
rocotilos's Avatar
 
Join Date: Oct 2009
Posts: 2,751
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
Old 02-09-2010, 03:40 AM   #2 (permalink)
indie dev
 
rocotilos's Avatar
 
Join Date: Oct 2009
Posts: 2,751
Default

BRAIN FART!

I missed out the delegate on the 2nd animation. (edited above post and highlighted the missing line of code)
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



» Advertisements
» Online Users: 621
15 members and 606 guests
aniuco, brianmethod, BrianSlick, dacapo, devangvyas, djohnson, Duncan C, emerldfds, holisticni8, learningtocode, linkmx, mollysalomons, Rudy, sudama, vikinara
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,773
Threads: 89,203
Posts: 380,580
Top Poster: BrianSlick (7,129)
Welcome to our newest member, holisticni8
Powered by vBadvanced CMPS v3.1.0

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