views:

130

answers:

1

I have a UIView in which I add a CATiledLayer and implement 'drawLayer'. If I use a UIViewController and add the layer to a new subview of the controller, then everything is ok.

If I however try to use a UIView to and do all the craetion and drawing within this, then I get a infinite loop at the point shown below when I add this view to a superview.

0x002cfafb  <+0425>  ja     0x2cfa23 <-[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:]+209>

What am I missing?

Update: By removing 'layer.delegate = self', the code no longer crashes...

A: 

Just found this:

http://www.iphonedevsdk.com/forum/iphone-sdk-development/18121-calayer-interesting-crash.html

"You can't set the delegate to be the same as the view's layer's delegate, which by default is the view itself"

Egil Jansson