title: Snapshot of UIView not scaling correctly?
body: <p>I have a <code>UIView canvas</code> which I would like to save a screen shot of it <strong>and it's subviews</strong> (which are the colorful shapes) on the camera roll when I press the <code>UIBarButton shareBarButton</code>. This works on the simulator, however, it does not produce the image in the way I like:</p>
  
  <ul>
  <li><a href="http://i.stack.imgur.com/dnrx7.png" rel="nofollow">Ideally what I would like the snapshot to look like</a> (except w/out the carrier, time, &amp; battery status on the top of the screen).</li>
  <li><a href="http://i.stack.imgur.com/cEXvl.png" rel="nofollow">What the snapshot in the camera roll actually looks like.</a></li>
  </ul>
  
  <p>I want the snapshot to look exactly like the way it looks on the iPhone screen. So if part of the shape goes beyond the screen, the snapshot will capture only the part of the shape that is visible on screen. I also want the snapshot to have the size of the <code>canvas</code> which is basically the size of the view except slightly shorter height:</p>
  
  <pre><code>canvas = UIView(frame: CGRectMake(0, 0, view.bounds.height, view.bounds.height-toolbar.bounds.height))
  </code></pre>
  
  <p>If someone could tell what I'm doing wrong in creating the snapshot that would be greatly appreciated!</p>
  
  <p>My code:</p>
  
  <pre><code>func share(sender: UIBarButtonItem) {
      let masterpiece = canvas.snapshotViewAfterScreenUpdates(true)
      let image = snapshot(masterpiece)
  
      UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil)
  }
  
  func snapshot(masterpiece: UIView) -&gt; UIImage{
      UIGraphicsBeginImageContextWithOptions(masterpiece.bounds.size, false, UIScreen.mainScreen().scale)
      masterpiece.drawViewHierarchyInRect(masterpiece.bounds, afterScreenUpdates: true)
      let image = UIGraphicsGetImageFromCurrentImageContext()
      UIGraphicsEndImageContext()
      return image
  
  }
  </code></pre>