[objective-c]UIImageを複製する

CGImageを使う方法

-(UIImage*)getCUIImage:(UIImage*)img{
    return [UIImage imageWithCGImage:[img CGImage]];
}

CGImageを使わない方法

-(UIImage*)getCopyUIImage:(UIImage*)imageToCopy{
    UIGraphicsBeginImageContext(imageToCopy.size);
    [imageToCopy drawInRect:CGRectMake(0, 0, imageToCopy.size.width, imageToCopy.size.height)];
    UIImage *copiedImage =UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();  
    return copiedImage;
}