Removing all CALayer's sublayers
The simplest way to remove all sublayers from a layer is to set the sublayer property to nil:
rootLayer.sublayers = nil;
The following should work:
for (CALayer *layer in [[rootLayer.sublayers copy] autorelease]) {
[layer removeFromSuperlayer];
}
[rootLayer.sublayers makeObjectsPerformSelector:@selector(removeFromSuperlayer)];