In Swift programming , how do you crop an image and put it on the center afterwards?
This is what I\'ve got so far ... I\'ve successfully crop the image but I want t
you can also use Alamofire and AlamofireImage to crop your image.
https://github.com/Alamofire/AlamofireImage
Installing using CocoaPods
pod 'AlamofireImage'
Usage:
let image = UIImage(named: "unicorn")!
let size = CGSize(width: 100.0, height: 100.0)
// Scale image to size disregarding aspect ratio
let scaledImage = image.af_imageScaled(to: size)
let aspectScaledToFitImage = image.af_imageAspectScaled(toFit: size)
// Scale image to fill specified size while maintaining aspect ratio
let aspectScaledToFillImage = image.af_imageAspectScaled(toFill: size)