I'm developing an iOs 5 iPhone app, I would like to take a screenshot programmatically when the user press a button of a view in the story board. I've tried many codes but they are for older versions of iOs. How can I do it in iOs 5. Thanks!!
- (void)drawRect:(CGRect)rect {
UIGraphicsBeginImageContext(self.bounds.size);
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
}