Specifically, I am looking to use CA on properties of types other than

  • integers and doubles
  • CGRect, CGPoint, CGSize, and CGAffineTransform structures
  • CATransform3D data structures
  • CGColor and CGImage references

and in objects other than CALayers or NSViews


Well, it seems I cannot do that. What I should be doing is subclassing NSAnimation. This will work on a MacOS 10.4+ app, but not on Cocoa Touch, in which I cannot find any alternatives apart from using a NSTimer.

+1  A: 

If you can do the changes yourself and the class you use is custom, you might want to add a setProgress:(float) f method to your class and use CA to animate it, then modify the desired properties as needed as a function of f.

Just do a

[[someObject animator] setValue:[NSNumber numberWithFloat:1.0] forKeyPath:@"someCustomProperty.progress"];

or if the object doesn't have an animator, create the correct CAAnimation yourself.


I am not sure exactly what you are trying to do, but if you want to use CA on other properties that is not an issue. You just need to register appropriate actions for the key path. There is an example of doing this in Apple's Core Animation documentaation, using CAAction. Specifically you implement actionForLayer:forKey: to configure the default animation behaviour of that key, and if you want to make the property animation implicitly you implement runActionForKey:object:arguments: .

As for animating objects other than CALayers, I really don't understand. Layers are the root visual entity in Core Animation. Additionally, on the iPhone every single UIView is backed on a layer, I do not believe there is anything on the iPhone's screen that is not in a layer, so I don't understand why you are worried about using animation on something that is not a CALayer.

Louis Gerbarg