- - (UIImage *)addImage:(UIImage *)image1 toImage:(UIImage *)image2 {
- UIGraphicsBeginImageContext(image1.size);
- // Draw image1
- [image1 drawInRect:CGRectMake(0, 0, 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;
- }
- //裁剪
- - (UIImage*) combineImageFromCuttingScreen {
UIGraphicsBeginImageContext(self.baseImageView.frame.size);
UIGraphicsBeginImageContextWithOptions(self.combineView.frame.size, YES, 1);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetShouldAntialias(context, YES);
CGContextSetShouldSmoothFonts(UIGraphicsGetCurrentContext(),YES);
CGContextSaveGState(context);
CGRect r = CGRectMake(0, 0, 320, 392);
UIRectClip(r);
[self.combineView.layer renderInContext:context];
UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return theImage;
}