iOS Current screen screenshot

Source: Internet
Author: User

Requirements Description:

There are two viewcontroller we remember to do A, B, where B controller only shows the lower part;

As the effect:

There are many ways to implement this, you can add a view method, or you can use Uiwindows to implement.

But my side is to use Presentviewcontroller implementation, but a present B, the previous a will disappear, will not and B overlay display, so it is quite a try to intercept a after the present B.

Take a look at the implementation plan:

Method One:

This method gets to the picture without distortion

1-(UIImage *) Captureimagefromviewlow: (UIView *) Orgview {2     //get a picture of a specified view3Uigraphicsbeginimagecontextwithoptions (OrgView.bounds.size, NO,0.0);4Cgcontextref context =Uigraphicsgetcurrentcontext ();5 [Orgview.layer Renderincontext:context];6UIImage *image =Uigraphicsgetimagefromcurrentimagecontext ();7 Uigraphicsendimagecontext ();8     returnimage;9}

Method Two:

Distortion occurs after the captured picture overlay is re-displayed

// get full screen picture -(UIImage *)        fullscreenshots{*screenwindow = [[uiapplicationsharedapplication] Keywindow];        Uigraphicsbeginimagecontext (screenWindow.frame.size); // full screen, including window         [ScreenWindow.layerrenderInContext:UIGraphicsGetCurrentContext ()];         *viewimage =uigraphicsgetimagefromcurrentimagecontext ();        Uigraphicsendimagecontext ();     return viewimage;}

In combination with these two scenarios, I finally chose the plan one

iOS Current screen screenshot

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.