Code to capture screenshot in iOS


This is method which take the screenshot of you current screen in iOS

- (UIImage*)captureView:(UIView *)view {
CGRect rect = [[UIScreen mainScreen] bounds];
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
[view.layer renderInContext:context];
UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return img;
}

Comments

Popular posts from this blog

How to enable curl option in php

Simple Socket programming using TCP in java