I've been trying to blend two UIImage for about 2 days now and I've been getting some BAD_ACCESS errors. First of all, I have two images that have the same orientation, basically I'm using the CoreGraphics to do the blending.
One curious detail, everytime I modify the code, the first time I compile and run it on device, I get to do everything I want without any sort of trouble. Once I restart the application, I get error and the program shuts down.
Can anyone give me a light? I tried accessing the baseImage sizes dynamically, but it gives me bad access too.
Here's a snippet of how I'm doing the blending.
UIGraphicsBeginImageContext(CGSizeMake(320, 480));
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextTranslateCTM(context, 0, 480);
CGContextScaleCTM(context, 1.0, -1.0);
CGContextDrawImage(context, rect, [baseImage CGImage]);
CGContextSetBlendMode(context, kCGBlendModeOverlay);
CGContextDrawImage(context, rect, [tmpImage CGImage]);
[transformationView setImage:UIGraphicsGetImageFromCurrentImageContext()];
UIGraphicsEndImageContext();
Complementing: Sometimes it gets to work perfectly, no problem. Sometimes it simply overlays and doesn't blend. Others it crashes the iphone.