草庐IT

ios - UIGraphicsGetImageFromCurrentImageContext ,分配版本?

coder 2024-01-28 原文

UIGraphicsGetImageFromCurrentImageContext 返回自动释放的 UIImage。

想知道是否有办法从上下文中获取“分配”图像?

我想要等同于以下代码的东西,也许代码是我能做的最好的?

NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];     
UIImage* image = get image by UIGraphicsGetImageFromCurrentImageContenxt
[image retain];
[pool release];

最佳答案

只需对结果调用-retain

UIImage *image = [UIGraphicsGetImageFromCurrentImageContext() retain];

关于ios - UIGraphicsGetImageFromCurrentImageContext ,分配版本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4643310/

有关ios - UIGraphicsGetImageFromCurrentImageContext ,分配版本?的更多相关文章

随机推荐