RoCry
2013-06-04 09:33:38 +08:00
- (UIImage *)addImage:(UIImage *)image1 toImage:(UIImage *)image2 {
UIGraphicsBeginImageContext(image2.size);
CGFloat x1 = (image2.size.width - image1.size.width) / 2.0;
CGFloat y1 = (image2.size.height - image1.size.height) / 2.0;
// Draw image1
[image1 drawInRect:CGRectMake(x1, y1, image1.size.width, image1.size.height)];
// Draw image2
[image2 drawInRect:CGRectMake(0, 0, image2.size.width, image2.size.height)];
UIImage *resultingImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return resultingImage;
}
// 我之前写的代码... 你稍微调一下就好了