原文:
https://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/CoreAnimation_guide/Articles/KVCAdditions.html
Key Path Support for Structure Fields
CAAnimation
provides support for accessing the fields of selected structures using key paths. This is useful for specifying these structure fields as the key paths for animations, as well as setting and getting values usingsetValue:forKeyPath:
and valueForKeyPath:
.
CATransform3D
exposes the following fields:
Structure Field | Description |
---|---|
| The rotation, in radians, in the x axis. |
| The rotation, in radians, in the y axis. |
| The rotation, in radians, in the z axis. |
| The rotation, in radians, in the z axis. This is identical to setting the |
| Scale factor for the x axis. |
| Scale factor for the y axis. |
| Scale factor for the z axis. |
| Average of all three scale factors. |
| Translate in the x axis. |
| Translate in the y axis. |
| Translate in the z axis. |
| Translate in the x and y axis. Value is an NSSize or CGSize. |
CGPoint
exposes the following fields:
Structure Field | Description |
---|---|
| The x component of the point. |
| The y component of the point. |
CGSize
exposes the following fields:
Structure Field | Description |
---|---|
| The width component of the size. |
| The height component of the size. |
CGRect
exposes the following fields:
Structure Field | Description |
---|---|
| The origin of the rectangle as a |
| The x component of the rectangle origin. |
| The y component of the rectangle origin. |
| The size of the rectangle as a |
| The width component of the rectangle size. |
| The height component of the rectangle size. |
You can not specify a structure field key path using Objective-C 2.0 properties. This will not work:
|
Instead you must use setValue:forKeyPath:
or valueForKeyPath:
as shown below:
|