I want to convert a UIView to a UIImage
- (UIImage *)renderToImage:(UIView *)view {
  if(UIGraphicsBeginImageContextWithOptions != NULL) {
    UIGraphicsBeginImageContextWithOptions(view.frame.size, NO, 0.0);
  } else {
    UIGraphicsBeginImageContext(view.frame.size);
  }
  [view.layer renderInContext:UIGraphicsGetCurrentContext()];
  UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
  UIGraphicsEndImageContext();
  return image;
}
Two questions:
- I have subviews on my view. Is there a way to create an image of the view without any of the subviews? Ideally id like to not have to remove them just to add them back later. 
- Also, it isn't rendering the images properly on retina devices. I followed the advice here to use context with options but it did not help. How to capture UIView to UIImage without loss of quality on retina display 
 
     
     
     
    