views:

710

answers:

1

There seems to be an delegate that can be set like myView.layer.delegate = anObject

The documentation just says:

delegate

Specifies the receiver’s delegate object.

@property(assign) id delegate

I wonder what kind of methods that delegate would implement, and when they would be called. Could solve some big problems with the presentationLayer, that doesn't return current values as expected.

UPDATE: Just found this in another Apple document:

Warning: Since the view is the layer’s delegate, you should never set the view as a delegate of another CALayer object. Additionally, you should never change the delegate of this layer.

+3  A: 

The delegate is used by CALayers. In the case of UIVIew, the view itself is the delegate and like you found, should not be changed.

If you create your own CALayer, then you can use the delegate to provide contents or manually draw to the layer.

See the Core Animation guide for more info.

Kailoa Kadano