iOS 13 UIGraphicsGetImageFromCurrentImageContext problem

hi, i use this code for render entire tableview as image. i need to render all cell without scroll the tableview.


UIGraphicsBeginImageContextWithOptions(CGSize(width: viewreal.contentSize.width, height: viewreal.contentSize.height), false, 0.0)

let context = UIGraphicsGetCurrentContext()

let previousFrame = viewreal.frame

print (self.viewreal.contentSize.height)

viewreal.frame = CGRect(x: viewreal.frame.origin.x, y: viewreal.frame.origin.y, width: viewreal.contentSize.width, height: viewreal.contentSize.height)

viewreal.layer.render(in: context!)

viewreal.frame = previousFrame

let image: UIImage = UIGraphicsGetImageFromCurrentImageContext()!

UIGraphicsEndImageContext()

return image;


in ios 12 and lower this code works and save all area as image

in IOS 13 not works because the hide area(scrolling cell) are not rendered like previous ios version.

Can we help me?

Hi combivox iam facing same issue.did you find any solution for this..

Please let me know

UIGraphicsBeginImageContextWithOptions(CGSize(width: viewreal.contentSize.width, height:  viewreal.contentSize.height), false, 0.0)
        let context = UIGraphicsGetCurrentContext()
        let previousFrame = viewreal.frame
        print (self.viewreal.contentSize.height)
        viewreal.frame = CGRect(x: viewreal.frame.origin.x, y:  viewreal.frame.origin.y, width: viewreal.contentSize.width, height: viewreal.contentSize.height)
        viewreal.layer.render(in: context!)
     
        viewreal.frame = previousFrame
     
        let image: UIImage = UIGraphicsGetImageFromCurrentImageContext()!
     
        UIGraphicsEndImageContext()
     
        return image;

What do you get as result of line 4 ?


Did you try setting opaque to true ?


Otherwise, your call should be equivlent to using:


UIGraphicsBeginImageContext(_ size: CGSize)


Should try, just to check.

Any news on this ? I am facing a similar problem.

Use viewreal.layer.frame instead viewreal.frame

iOS 13 UIGraphicsGetImageFromCurrentImageContext problem
 
 
Q