1. Capture a picture of the selected view
// creates a bitmap-based graphics context based on size CGRect rect =view.frame; Uigraphicsbeginimagecontext (rect.size); // creates a bitmap-based graphics context based on size Cgcontextref context = Uigraphicsgetcurrentcontext (); // Get context Environment [View.layer Renderincontext:context]; // Map The view you want to intercept onto the canvas // get picture uigraphicsendimagecontext (); = img; [View Sethidden:yes];
2. Two photos to synthesize a picture
//Create a canvas based on the underlying imageview laughterUigraphicsbeginimagecontext (imgVC_bg.image.size); for(Uiimageview *IMGVCinchArray_imageview) {UIImage*img=Imgvc.image; //draw the IMG to be added to the IMGVC[img Drawinrect:cgrectmake (imgvc.frame.origin.x/double_proportion, (imgvc.frame.origin.y- -)/double_proportion,imgvc.frame.size.width/double_proportion,imgvc.frame.size.height/double_proportion)]; [IMGVC Removefromsuperview]; } //in the bottom IMGVC, this will add IMG to the IMGVC. [Imgvc_bg.image Drawinrect:cgrectmake (0,0, ImgVC_bg.image.size.width, ImgVC_bg.image.size.height)]; //form a new imageCgimageref newmergeimg =Cgimagecreatewithimageinrect (Uigraphicsgetimagefromcurrentimagecontext (). Cgimage, CGRectMake (0,0, ImgVC_bg.image.size.width, imgVC_bg.image.size.height)); Uigraphicsendimagecontext ();
iOS-related actions