I have three views on my storyboard, viewA
, viewB
, viewC
.
I’m trying to screen capture only two views as they appear on screen in their current place, viewB
and viewC
.
The trouble is, when I render them, the resulting image captured shows viewB
and viewC
in incorrect locations, the position of the views change moving top left (0, 0), see image.
How can I correct the code below so that I can capture the views viewB
and viewC
exactly as they are positioned on the view using the renderInContext
implementation below?
UIGraphicsBeginImageContextWithOptions(self.view.frame.size, false, 0)
self.viewB.layer.renderInContext(UIGraphicsGetCurrentContext()!)
self.viewC.layer.renderInContext(UIGraphicsGetCurrentContext()!)
let image = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()