Reputation: 19143
I was pretty sure I had seen discussions of this around the Net, but now I can't seem to find anything. The question is simple: is there a way to use for example CABasicAnimation
to animate a property on an object that's not a ´CALayer´? (Say, the ´volume´ property on an ´AVAudioPlayer´.)
If not, is there a way to make it work other than subclassing ´CALayer´? Maybe some protocol to conform to?
EDIT: How about doing this on the iPhone OS?
Upvotes: 2
Views: 614
Reputation: 46020
You can indeed do this. Your object must implement the NSAnimatablePropertyContainer
protocol and return a valid CAAnimation
object for each property you want to animate in the +defaultAnimationForKey:
class method.
To answer your updated question, no, you can't do this on the iPhone at present as there is no NSAnimatablePropertyContainer
protocol available in iPhone OS and you can't get an animator
proxy object from other objects.
Upvotes: 7