CALayer学习

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方法!!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值