In portrait mode (first time drawing)

After rotating to landscape, why are the older shapes:

I am using UIBezierPath & CAShapeLayer to draw circles & lines in a custom UIView's layer. The problem is inspite of being able to draw new circles & lines successfully after device is rotated, I am unable to remove the older drawn shapes.
The new shapes drawn after device rotation are perfect, I just need to remove from screen those older shapes sticking in the screen.
Images attached.
You can either remove the previous CAShapeLayer (with removeFromSuperlayer) or replace the path of the previous CAShapeLayer. You would appear to be adding a new layer without removing the old one, but of course it is impossible to tell without source code.
aah!
found the solution
using rootView.layer.sublayers = nil removed all earlier shapes
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With