قالب وردپرس درنا توس
Home / IOS Development / ios – The snapshot scaled UIView

ios – The snapshot scaled UIView



Snapshotting of a UIView using UIGraphicsGetImageFromCurrentImageContext () and a number of other approaches including render (i :) and [19459archy]: afterScreen 🙂 functions work well when you need to render a normal view.

I did not manage to make any of this work properly when trying to draw a scaled UIView hierarchy. The view in question is a UIScrollView & # 39; s content and zoom view.

The view and its supervision refuse to make any transformations just before the snapshot that would solve the scaling problem. The result is that the snapshot either looks like:

  • A) a sadly cropped view, originating at the top left (as expected on iOS), but then only expanding to untransformed "boundaries" of the view. If the view has no zoom or scale transform this is fine, but rarely if ever happens.
  • B) a large section with large black edges corresponding to the transformed "frame" of the view. I guess this happens because of something strange by snapshot a frame of a scaled view.

TL; DR : Unable to snapshot / render a UIView after it was scaled and zoomed by a UIScrollView despite attempts to transform or redraw before snapshotting.


Source link