(UIImage *) cropToSquare:(UIImage *)_image
{
if(_image.size.height < _image.size.width)
{
CGRect drawRect = CGRectMake(0, 0, _image.size.height, _image.size.height);
UIGraphicsBeginImageContext(drawRect.size);
CGContextRef currentContext = UIGraphicsGetCurrentContext();
CGRect cropArea = CGRectMake (((_image.size.width - _image.size.height)/2), 0, _image.size.height, _image.size.height);
CGContextTranslateCTM(currentContext, 0.0, _image.size.height);
CGContextScaleCTM(currentContext, 1.0, -1.0);
CGContextDrawImage(currentContext, drawRect, CGImageCreateWithImageInRect (_image.CGImage, cropArea));
UIImage *cropped = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return cropped;
}
else
{
return _image;
}
}
行CGContextDrawImage(currentContext、drawRect、CGImageCreateWithImageInRect(_image.CGImage、cropArea))は、100%のリークをタグ付けしました。
CG関連のリリースを自分で行う必要があることはありますか?
ありがとう