Able to capture UIImage as-is based on content mode from UIimageView?

后端 未结 1 1231
醉话见心
醉话见心 2021-01-26 02:16

I was wondering if there is a way to capture an UIImage as it appears as-is viewed in an UIImageView based on its contentMode

1条回答
  •  旧巷少年郎
    2021-01-26 02:42

    You can capture a "screen shot" of the way a UIImageView is actually displayed by calling CALayer's renderInContext: method.

    https://developer.apple.com/library/ios/documentation/graphicsimaging/reference/CALayer_class/Introduction/Introduction.html#//apple_ref/occ/instm/CALayer/renderInContext:

    0 讨论(0)
提交回复
热议问题