• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: CATransition done (get the key?)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CATransition done (get the key?)


  • Subject: Re: CATransition done (get the key?)
  • From: Matt Neuburg <email@hidden>
  • Date: Wed, 13 Jan 2010 09:38:22 -0800
  • Thread-topic: CATransition done (get the key?)

On Wed, 13 Jan 2010 09:44:55 -0500, "Eric E. Dolecki" <email@hidden>
said:
>Currently I am using CATransition to display a subview:
>
>[window addSubview:monthView.view];
>
>CATransition *animation = [CATransition animation];
>
>[animation setDuration:0.25];
>
>*[animation setDelegate:self];*
>
>[animation setType:kCATransitionPush];
>
>[animation setSubtype:kCATransitionFromLeft];
>
>[animation setTimingFunction:[CAMediaTimingFunction
>functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
>
>[[monthView.view layer] addAnimation:animation forKey:@"fadeIn"];
>
>
>So that delegate opens up a callback for animationDidStop:
>
>- (void)animationDidStop:(CAAnimation *)theAnimation finished: (BOOL)flag {
>
>However I also have a method to dismiss a subView using CATransition - and
>the same callback is called. How can I determine what the *key* is in the
>animationDidStop? I basically just need to determine in what context the
>animationDidStop is being called.
>
>Thanks for any pointers. Continuing to Google.

I think this is what you're looking for:

http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CoreAn
imation_guide/Articles/KVCAdditions.html

What this extremely cool first section is trying to tell you is that you can
set an arbitrary non-existent key on your animation and retrieve it later.
"Arbitrary" means you define the key - as if a CAAnimation were an
NSDictionary. So you can mark your animation in any way you want, as a way
of identifying it later. Example code typed in mail, don't take literally:

CATransition *animation = [CATransition animation];
[animation setValue: @"fadeIn" forKey: @"wtfIsThis"];

And later:

- (void)animationDidStop:(CAAnimation *)theAnimation finished: (BOOL)flag {
   id wtf = [theAnimation valueForKey: @"wtfIsThis"]; // and so on

m.

--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.tidbits.com/matt/default.html#applescriptthings



_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Displaying a non-contentual menu & attachPopUpWithFrame
  • Next by Date: Re: iPhone: CATransition done (get the key?)
  • Previous by thread: Re: Displaying a non-contentual menu & attachPopUpWithFrame
  • Next by thread: Best practice example for a setup wizard?
  • Index(es):
    • Date
    • Thread