- (UIImage*)addImage:(UIImage*)image1 toImage:(UIImage*)image2
{
//将底部的一张的大小作为所截取的合成图的尺寸
UIGraphicsBeginImageContext(CGSizeMake(image2.size.width, image2.size.height+image1.size.height));
// Draw image2,底下的
[image2drawInRect:CGRectMake(0, 0, image2.size.width, image2.size.height)];
[image1drawInRect:CGRectMake(0,image2.size.height, image1.size.width, image1.size.height)];
UIImage *resultingImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
returnresultingImage;
}
网友评论