The usage is simple, as follows
#pragmaMark-Multiple images to synthesize a + (UIImage *) Mergedimages: (Nsarray *) Imagesarray {cgfloat maxWidth= the;//Consider phone screen widthCGFloat totalheight =0; //Calculate the height of a picture for(UIImage *imageinchImagesarray) {Totalheight+ = Image.size.height * MaxWidth/Image.size.width; } //Drawing ContextUigraphicsbeginimagecontext (Cgsizemake (MaxWidth, totalheight)); Totalheight=0; for(UIImage *imageinchImagesarray) {CGFloat ImageWidth=MaxWidth; CGFloat ImageHeight= Image.size.height * MaxWidth/Image.size.width; [Image Drawinrect:cgrectmake (0, Totalheight, ImageWidth, ImageHeight)]; Totalheight+=ImageHeight; }
Generate Picture UIImage*resultingimage =Uigraphicsgetimagefromcurrentimagecontext (); //Release ContextUigraphicsendimagecontext (); returnresultingimage;}
Multiple images of iOS to synthesize a picture