gpt4 book ai didi

iphone - 在 iPhone 中缝合图片

转载 作者:行者123 更新时间:2023-12-03 20:22:52 25 4
gpt4 key购买 nike

我想并排缝合2张png。在Cocoa中,我会使用[NSImage initWithSize],然后只是drawInRect。

但是 UIImage 没有 initWithSize 类,我现在该怎么做?

最佳答案

使用UIGraphicsBeginImageContext(),在其中绘制,然后使用UIGraphicsGetImageFromCurrentImageContext()。请记住随后使用 UIGraphicsEndImageContext() 弹出上下文。

如果您只想在屏幕上显示两个图像,则应避免创建额外的图像,因为设备上的可用内存有限。相反,使用适当的 drawInRect: 调用来显示它们以避免复制。

关于iphone - 在 iPhone 中缝合图片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/218388/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com