난 내 응용 프로그램이 버그를 얻을 왜 내가 두 번째[있는 UIImage 크기] : 할당이 해제 된 인스턴스에 보낸 메시지 0x8452560
-(UIImage *)rotateImage:(UIImage *)image{
// calculate the size of the rotated view's containing box for our drawing space
CGSize rotatedSize = image.size;
// Create the bitmap context
UIGraphicsBeginImageContext(rotatedSize);
CGContextRef bitmap = UIGraphicsGetCurrentContext();
// Move the origin to the middle of the image so we will rotate and scale around the center.
CGContextTranslateCTM(bitmap, rotatedSize.width/2, rotatedSize.height/2);
// // Rotate the image context
CGContextRotateCTM(bitmap, DegreesToRadians(90));
// Now, draw the rotated/scaled image into the context
CGContextScaleCTM(bitmap, 1.0, -1.0);
CGContextDrawImage(bitmap, CGRectMake(-image.size.width/2, -image.size.height/2, image.size.width, image.size.height), image.CGImage);
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return newImage;
}
에서 이미지를 회전 할 때 알려진 해달라고 난에 의해이 함수를 호출 :
NSLog(@"%f %f",rotatedOriginImage.size.width,rotatedOriginImage.size.height);
rotatedOriginImage = [self rotateImage:rotatedOriginImage];
2012-07-11 17:22:50.825 meshtiles[3330:707] 600.000000 600.000000
을하지만 제 시점 :
처음에 그 기록
01,235 당신은 ARC를 사용하지 않는 경우 16,2012-07-11 17:22:55.253 meshtiles[3330:707] *** -[UIImage size]: message sent to deallocated instance 0x8452560
이 경우에 대한 지원, 당신은 당신의 방법에서 오토 릴리즈 객체 newImage
를 반환하는 나에게
'rotateOriginImage'가 어디서 왔는지 보여줄 필요가있다. 문제는'-rotateImage :'메소드에 있지 않다. 문제는 당신이 제공 한 객체가 과량 릴리즈되었다는 것이다. – joerick
첫회와 두 번째로 무엇을 의미합니까? 회전 전과 회전 후입니까? rotateOriginImage를 확인해야합니다. 코드에서 어딘가에 릴리스 되었습니까? – AJS
"rotateImage"메서드가 호출 된 후 "rotateOriginImage"가 설정되고 이미지가 반환됩니다. 그리고 설정하기 전에 크기에 액세스하고 있습니다. NSLog 문은 "rotateImage"메서드가 호출 된 곳의 라인에 있어야합니다. – AJS