Advertisement
Guest User

1f

a guest
Aug 12th, 2015
561
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. func imagePickerController(picker: UIImagePickerController, didFinishPickingImage image: UIImage!, editingInfo: [NSObject : AnyObject]!) {
  2. imageView.image = image
  3. let size = CGSizeApplyAffineTransform(image.size, CGAffineTransformMakeScale(0.5, 0.5))
  4. let hasAlpha = false
  5. let scale: CGFloat = 0.0 // Automatically use scale factor of main screen
  6.  
  7. UIGraphicsBeginImageContextWithOptions(size, !hasAlpha, scale)
  8. image.drawInRect(CGRect(origin: CGPointZero, size: size))
  9.  
  10. let scaledImage = UIGraphicsGetImageFromCurrentImageContext()
  11. UIGraphicsEndImageContext()
  12. dismissViewControllerAnimated(true, completion: nil)
  13. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement