S.P.K
S.P.K

Reputation: 13

Swift: how could I draw lines inside UIImageView?

I use CGContext in a subclass of UIView to draw lines, it works fine when no other views in the ViewController on storyboard. However each time putting in an `UIImageView' with an image, it'd cover parts of the lines.

But I wanna draw several lines inside the UIImageView or inside the image. What should I do?

Would someone help me with it?

Upvotes: 1

Views: 644

Answers (1)

matt
matt

Reputation: 535139

You cannot modify the drawing of an image view. If you want lines to appear in an image view, you must modify the image that it contains. Make a new image context, draw the image into it, draw the lines, extract the new image, and assign that image to the image view.

Upvotes: 1

Related Questions