In an attempt to capture a screenshot, everything but the UILabels is being captured. I've checked the view hierarchy to see if the labels were being hidden somehow but everything looks fine.
By the way, I am happy that the navigation controller is hidden in the screenshot, I just need to figure out why the labels are hidden.
I am not sure where I am going wrong.
@IBAction func cameraBarButtonItem(_ sender: UIBarButtonItem) {
UIGraphicsBeginImageContextWithOptions(view.bounds.size, false, UIScreen.main.scale)
guard let context = UIGraphicsGetCurrentContext() else {
print("No Graphics Context")
return
}
view.layer.render(in: context)
let image = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
print("Photo Screen Captured")
guard let photoImage = image else {
return
}
guard let imageData = UIImageJPEGRepresentation(photoImage, 1.0) else {
return
}
userQueue.async {
savePhotoToPhotoLibrary(data: imageData) {
}
}
}