iPhone SDK - 如何将一个 UIImage 绘制到另一个 UIImage 上?
我有几个矩形图像(横向和纵向模式),想要将它们绘制到透明的方形图像上,以便所有图像变得相同大小而不裁剪它们。我如何创建一个透明的 UIImage 并在上面绘制另一个?
感谢您的任何提示。
I have several rectangular images (in landscape and portrait mode) and want to draw them onto a transparent square image, so that all images became the same size without cropping them. How would I create a transparent UIImage and draw another on top?
Thanks for any hints.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
[UIImage imageWithCGIImage:]
将步骤 #3 中的 Core Graphics 图像转换为 UIImage。代码示例可以在 此处。
CGBitmapContextCreate
. You'll need to determine what the size of the resulting composite image here. You can think of this as a sort of canvas.CGContextDrawImage
. This will draw images onto the same context.CGBitmapContextCreateImage
.[UIImage imageWithCGIImage:]
.Code examples can be found here.