If you want to capture screen of an iOS device as you take the same from iPhone by pressing 'Power' button an 'Home' button then here is the code. It will take screen shot even if there is any transformation or transition running.
First you have to write this function where only two lines are written. In the first line of code it take snapshot of that particular view which you will mention here. Where as in the second line of code, it takes that area's screen shot and save it to the photo gallery of the device.
In this final function we are getting the graphic context of the view which we have passed in the above function.
- (UIImage *)snapshot:(UIView *)view
UIGraphicsBeginImageContextWithOptions(backGroundView.frame.size, NO, 0.0);
// Render our snapshot into the image context
[view drawViewHierarchyInRect:view.bounds afterScreenUpdates:YES];
// Grab the image from the context
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
// Finish using the context