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 set background color of navigation bar in iPhone

Checking Device Info in ios

Some Interactive tips to take input form GUI Dialogs