iOS Swift: How to properly scale down an image?
问题 I'm using AlamofireImage to download and set my UIImage: backdrop.af_setImageWithURL(downloadURL) The image is substantially larger than what I will be displaying and so I have an issue with aliasing. How can I resize this image properly? Results: 回答1: You can resize the image with any size once you have a valid UIImage : func resizedImageWith(image: UIImage, targetSize: CGSize) -> UIImage { let imageSize = image.size let newWidth = targetSize.width / image.size.width let newHeight =