UIView
1. + (Class)layerClass
This method is called only once early in the creation of the view in order to create the corresponding layer object.
CAlayer
2.- actionForKey:
When that property changes, the layer looks for the action object associated with the property name and executes it. You can also associate custom action objects with your layer to implement app-specific actions.
This method searches for the layer’s associated actions in the following order:
If the layer has a delegate that implements the actionForLayer:forKey: method, the layer calls that method. The delegate must do one of the following:
Return the action object for the given key.
Return the NSNull object if it does not handle the action.
The layer looks in the layer’s actions dictionary for a matching key/action pair.
The layer looks in the style dictionary for an actions dictionary for a matching key/action pair.
The layer calls the defaultActionForKey: class method to look for any class-defined actions.
If any of the above steps returns an instance of NSNull, it is converted to nil before continuing.
When an action object is invoked it receives three parameters: the name of the event, the object on which the event happened (the layer), and a dictionary of named arguments specific to each event kind.
3.+ needsDisplayForKey:
Returns a Boolean indicating whether changes to the specified key require the layer to be redisplayed.
Subclasses can override this method and return YES if the layer should be redisplayed when the value of the specified attribute changes. Animations changing the value of the attribute also trigger redisplay.
4.很重要的
@dynamic customProperty
让layer自动合成自定义属性的setter方法!!