eugene
eugene

Reputation: 41665

UIGraphicsGetImageFromCurrentImageContext , alloc version?

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

Answers (1)

Lily Ballard
Lily Ballard

Reputation: 185681

Just call -retain on the result.

UIImage *image = [UIGraphicsGetImageFromCurrentImageContext() retain];

Upvotes: 1

Related Questions