From 40a1f98cbc39317c3e4b883ecdaf07422f023392 Mon Sep 17 00:00:00 2001 From: Sarthak Khillon Date: Sun, 29 Mar 2020 21:58:23 -0700 Subject: [PATCH] Fix Issue 276 --- .../Nodes/LocationAnnotationNode.swift | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Sources/ARKit-CoreLocation/Nodes/LocationAnnotationNode.swift b/Sources/ARKit-CoreLocation/Nodes/LocationAnnotationNode.swift index 6a7ceaab..d9b960ea 100644 --- a/Sources/ARKit-CoreLocation/Nodes/LocationAnnotationNode.swift +++ b/Sources/ARKit-CoreLocation/Nodes/LocationAnnotationNode.swift @@ -128,12 +128,12 @@ open class LocationAnnotationNode: LocationNode { public extension UIView { @available(iOS 10.0, *) - /// Gets you an image from the view. + /// Gets you an image from the view. Source: https://stackoverflow.com/a/22494886/3131790 var image: UIImage { - let renderer = UIGraphicsImageRenderer(bounds: bounds) - return renderer.image { rendererContext in - layer.render(in: rendererContext.cgContext) - } + UIGraphicsBeginImageContextWithOptions(bounds.size, isOpaque, 0) + defer { UIGraphicsEndImageContext() } + drawHierarchy(in: bounds, afterScreenUpdates: true) + return UIGraphicsGetImageFromCurrentImageContext() ?? UIImage() } }