문제

I have one UIImage which I want to deep copy to another (so that I may add it to an NSMUtableArray of images)

I cannot get it to deep copy, I have looked at zones and such but this no luck.

This is what I have trieD:

_incrementalImage = UIGraphicsGetImageFromCurrentImageContext();

UIImage *imgcpy = [[UIImage allocWithZone:[_incrementalImage zone]];
[stack addObject:imgcpy];

Basically I need a copy of incrementalImage onto stack that won't change if _incrementalImage or currentImageContext changes.

도움이 되었습니까?

해결책

UIImage *image1 = [UIImage imageNamed:@"someImage"];
UIImage *image2 = [UIImage imageWithCGImage:image1.CGImage];
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top