6

In my application I want to record view with Still Images. Is there any way to take screenshot of view using AvCaptureSession? What I will do is ,will capture images of view and after that will use all images to make video of that view. I have refer this link also https://github.com/immortalLion/iPhoneScreenRecord/tree/master/ScreenCaptureViewTest. I know we can capture screenshot using IOSurface but I don't want to capture whole screen instead I want to capture view only. I'd like to set Framerate & with Rendering Good Scale Thanks in advance.

Narendra Mistri
  • 113
  • 2
  • 8
S S
  • 646
  • 1
  • 7
  • 16
  • You should Check this answer [Here](http://stackoverflow.com/questions/11334977/screen-capture-video-in-ios-programmatically) Hope this will help you. http://codethink.no-ip.org/wordpress/archives/673 – Narendra Mistri Mar 11 '14 at 09:07

1 Answers1

0

This will capture the view as image and you can specify the frame of the view.

- (UIImage *)captureView:(UIView *)view {
        CGRect screenRect = [[UIScreen mainScreen] bounds];

        UIGraphicsBeginImageContext(screenRect.size);

        CGContextRef ctx = UIGraphicsGetCurrentContext();
        [[UIColor blackColor] set];
        CGContextFillRect(ctx, screenRect);

        [view.layer renderInContext:ctx];

        UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();

        UIGraphicsEndImageContext();

        return newImage;
    }
Deepak
  • 1,278
  • 3
  • 15
  • 23