I attach a base layer to a custom view as follows:

 [view setWantsLayer:YES];

then I add several layers with:

 CALayer *layer = [CALayer layer];
 layer.name = @"test";
 [view.layer addSublayer:layer];

the view draws and each layer draws thru the designated drawRect and drawLayer methods, and all this looks fine.

However, I have an action that removes all layers but this crashes on
removeFromSuperlayer:

 NSArray *theLayers = [[self layer] sublayers];
  for(CALayer *layer in sublayers) {
    [layer removeFromSuperlayer];

I'm new to CALayer and at a loss as to what could be wrong with this.
Any suggestions would be appreciated.
(I've read  through most of Dudney's Core Animation book but nothing
jumps out at me.)

Dennis Christopher

_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to