Advertisement
Guest User

Untitled

a guest
Jul 30th, 2015
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. func captureScreen() -> UIImage {
  2. let layer: CALayer = UIApplication.sharedApplication().keyWindow!.layer
  3. let scale: CGFloat = UIScreen.mainScreen().scale
  4. UIGraphicsBeginImageContextWithOptions(layer.frame.size, layer.opaque, scale)
  5. layer.renderInContext(UIGraphicsGetCurrentContext())
  6. let image = UIGraphicsGetImageFromCurrentImageContext()
  7. UIGraphicsEndImageContext()
  8. return image
  9. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement