I need some help.
I use sd_setImageWithURL like tihs
self.downloadButton.addTarget(self, action: #selector(self.stopDownloading), forControlEvents: .TouchUpInside)
self.imageView.sd_setImageWithURL(NSURL(string:myURL!)!, placeholderImage: UIImage(named: "placeHolderImage"), options: SDWebImageOptions.ProgressiveDownload , progress: {
(receivedSize: Int!, expectedSize: Int!) in
if(receivedSize > 0 )
{
self.percentString = String(format: "%.0f",(Float(receivedSize) / Float(expectedSize) * 100))
[self.downloadProgress.setProgress(Float(receivedSize) / Float(expectedSize), animated: true)]
self.downloadStateLabel.text = "\(receivedSize/1000000) / \(expectedSize/1000000)MB (\(self.percentString)%)"
NSLog("%@", self.percentString)
}
}, completed: {
(image, error, cacheType, url) in
NSLog("Completed'");
})
func stopDownloading(sender: AnyObject)
{
NSLog("stopDownloading Clicked")
self.imageView.sd_cancelCurrentImageLoad()
}
when I click Button I can get Log "stopDownloading Clicked" in stopDownloading function but sd_cancelCurrentImageLoad() didn't work.
just keep downloading and I can get Completed Log.
How can I stop downloading or cancel sd_setImageWithURL in progress ??
Thx.