To achieve this, you can use - (BOOL)drawViewHierarchyInRect:(CGRect)rect afterScreenUpdates:(BOOL)afterUpdates
.
UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, self.view.opaque, 0.0);
[self.view drawViewHierarchyInRect:self.view.bounds afterScreenUpdates:NO];
//The merged image.
UIImage * mergedBackground = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
//Remove superviews as they are no longer required.
[self.view.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];