开发者

Infinite loop when adding CATiledLayer to UIView

开发者 https://www.devze.com 2022-12-26 01:11 出处:网络
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.

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 in开发者_开发问答finite 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...


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"

0

精彩评论

暂无评论...
验证码 换一张
取 消