Created
November 4, 2018 12:34
-
-
Save thekan23/cb07a449fb250a254c2b1cde479f17db to your computer and use it in GitHub Desktop.
UIKit 프레임워크를 사용한 이미지 리사이징
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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