Kazak Kazak - 1 year ago 185
Swift Question

How to clear ImageView in swift?

I drew some lines on imageView and I need to clear my screen. How can I clear imageView?

When I was working with CGShapeLayer I was using removeFromSuperlayer.
Is there any alternative to this function?

weak var shapeLayer: CAShapeLayer?

Answer Source

one good option could be to do myImageView.image = nil, so you could re assign an image to your imageView after that, without having to add it again to the view.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download