我有200px x 200px UIImageView
在UICollectionViewCell
將顯示來自URL的圖像。問題是我不知道URL提供的分辨率圖像是什麼,我認爲最好在放入UIImageView
之前調整它的大小,這是由於內存消耗。調整大小下載圖片AlamofireImage
我已經使用alamofire下載圖像
let url = NSURL(string: "http:\(product.picUrl)")
self.imgProductItem.af_setImageWithURL(url!, placeholderImage: UIImage(named: "app_default-resize"))
我想知道是否有任何先調整之前,用它在UIImageView
放置方法?如果有任何提示下載圖像以節省內存使用量,我想聽聽。
任何幫助,將不勝感激。謝謝。
那麼alamofire不包括那些功能? –
我不認爲Alamofire自己做任何調整大小,我很確定你需要通過URL或NSData獲取圖像,然後創建圖像,然後調整它的大小。 Alamofire更像是「從數據庫中獲取東西」的API – impression7vx
它通過過濾器來調整大小。見https://github.com/Alamofire/AlamofireImage#image-filters-1。 – Rob