Re: CALayer instant content update
Re: CALayer instant content update
- Subject: Re: CALayer instant content update
- From: Matt Neuburg <email@hidden>
- Date: Mon, 13 Sep 2010 07:58:14 -0700
- Thread-topic: CALayer instant content update
On Fri, 3 Sep 2010 10:44:44 -0700, David Duncan <email@hidden>
said:
>If you want to have a layer that doesn't animate (crossfade) content changes,
then set the layer's actions dictionary like so:
>
>layer.actions = [NSDictionary dictionaryWithObject:[NSNull null]
forKey:@"contents"];
>
>This will prevent animation of the "contents" property. There are a lot of
other ways to do this too, I would recommend you read the documentation for
-[CALayer actionForKey:] for more details.
I would recommend that Apple improve the documentation so that the details
on actionForKey: are correct and complete. The documentation on this point
is probably the worst written and most incorrect and incomplete of anything
in the corpus. The particular document containing at least an attempt at
describing the action mechanism is this one:
<http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/Core
Animation_guide/Articles/Actions.html>
But it *never* explicitly states the point you're making, that not only the
delegate but the actions dictionary, or any point along the search for an
action, can return NSNull to stop the search and prevent animation.
Other mistakes on that page include:
* The hidden property being set to NO or YES generates a search for an
action by the key kCAOnOrderIn or kCAOnOrderOut. (False. That key would be
@"hidden".)
* replaceSublayer:with: generates a search for an action by the key
kCATransition. (False. That key would be @"sublayers". As far as I can tell,
*nothing* ever generates a search on kCATransition.)
* Several other action search triggers, such as layout of the layer, are
omitted entirely.
The summary under actionForKey: on the CALayer class documentation page is,
if anything, even worse:
* "Return the value NULL if the search should not continue." (False. The
value to return, to stop the search, is [NSNull null]. And this is true for
every stage of the search, not just the first.)
* "If nil is returned their is no action specified for requested key."
(Gibberish, and even more so standing alone as a bulleted item in the middle
of the list.)
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.apeth.net/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