Answers for "xcode create image from calayer"

0

xcode create image from calayer

func imageFromLayer(layer:CALayer) -> UIImage {
    UIGraphicsBeginImageContextWithOptions(layer.frame.size, layer.isOpaque, 0)
    layer.render(in: UIGraphicsGetCurrentContext()!)
    let outputImage = UIGraphicsGetImageFromCurrentImageContext()
    UIGraphicsEndImageContext()
    return outputImage!
}
Posted by: Guest on September-07-2020

Code answers related to "Swift"

Browse Popular Code Answers by Language