Find bounding box for CALayer to draw into graphics context

Friday, July 4, 2014

I have a CALayer with multiple sublayers. clipsToBounds is NO (default). I want to draw the complete content of the CALayer (incl. all sublayers) into an image context. For that I need to determine how big the context needs to be. Is there a method on CALayer to retrieve the required size for a graphics context, in order to fit all content in? (i.e. also the content that is beyond the layer's bounds)