iOS Actions for screenshots

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.