Reputation: 41665
UIGraphicsGetImageFromCurrentImageContext returns autoreleased UIImage.
Wonder if there is a way to get "alloc"-ed image from context?
I want something equivalent to following code, maybe the code is best I can do?
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
UIImage* image = get image by UIGraphicsGetImageFromCurrentImageContenxt
[image retain];
[pool release];
Upvotes: 2
Views: 2682
Reputation: 185681
Just call -retain
on the result.
UIImage *image = [UIGraphicsGetImageFromCurrentImageContext() retain];
Upvotes: 1