I add several CALayers as sublayers of the UIView layer. The content of each layer is a different image downloaded from the server. Each layer is animated from the screen to a randomly generated position. Image data is loaded asynchronously. Each image is approximately 300x300 or less.
As a result of random placement, the layers overlap, and some are obscured by layers above them. This is all good.
I delete the layers as they completely close the view using the sentence answer to this question . Calculations to determine coverage occur in a separate stream.
I have a UIPanGestureRecognizer that allows the user to drag and drop layers around the screen.
I ran into a performance issue when the number of layers added approaches 25-30 and it gets worse. Animation becomes volatile and often completely absent (recently added layers just appear in their final position). And panorama gestures are either ignored or result in a mutable movement of the selected layer.
Am I assuming I'm killing a GPU with all overlapping layers and another animation layer above?
Any suggestions on how to improve performance?
Recommendations for working with a large number of layers?
Is it better to start animating a layer in a separate view than previously added layers?
Thanks!
Tomh
source share