我想知道是否有办法捕获UIImage
看起来as-is查看于UIImageView
基于其contentMode
。例如,如果我通过3:4
与正方形的长宽比UIImageView
,并使用“Aspect Fit”作为contentMode
,然后我希望在图像的左右部分看到白色信箱来填充正方形。那么是否可以将出现的任何内容直接保存为新的UIImage
与字母拳击?
Thanks!
您可以通过调用 CALayer 来捕获 UIImageView 实际显示方式的“屏幕截图”renderInContext:
method.
https://developer.apple.com/library/ios/documentation/graphicsimaging/reference/CALayer_class/Introduction/Introduction.html#//apple_ref/occ/instm/CALayer/renderInContext https://developer.apple.com/library/ios/documentation/graphicsimaging/reference/CALayer_class/Introduction/Introduction.html#//apple_ref/occ/instm/CALayer/renderInContext:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)