Guest User

Untitled

a guest
Nov 18th, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. extension UIImage {
  2. func resizeToCircleImage(targetSize: CGSize, contentMode: UIViewContentMode) -> UIImage {
  3. UIGraphicsBeginImageContextWithOptions(targetSize, true, 0.0)
  4. let rect = CGRect(x: 0, y: 0, width: targetSize.width, height: targetSize.height)
  5. self.draw(in: rect)
  6. let newImage = UIGraphicsGetImageFromCurrentImageContext()
  7. UIGraphicsEndImageContext()
  8. return newImage!
  9. }
  10. }
Add Comment
Please, Sign In to add comment