Skip to content

Instantly share code, notes, and snippets.

@thekan23
Created November 4, 2018 12:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thekan23/cb07a449fb250a254c2b1cde479f17db to your computer and use it in GitHub Desktop.
Save thekan23/cb07a449fb250a254c2b1cde479f17db to your computer and use it in GitHub Desktop.
UIKit 프레임워크를 사용한 이미지 리사이징
extension UIImage {
func resizeUI(size:CGSize) -> UIImage? {
UIGraphicsBeginImageContextWithOptions(size, true, self.scale)
self.drawInRect(CGRect(origin: CGPointZero, size: size))
let resizedImage = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return resizedImage
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment