onevcat 10 rokov pred
rodič
commit
adaaf606e4

+ 2 - 0
Kingfisher-Demo/ViewController.swift

@@ -56,6 +56,8 @@ extension ViewController {
     }
     
     override func collectionView(collectionView: UICollectionView, didEndDisplayingCell cell: UICollectionViewCell, forItemAtIndexPath indexPath: NSIndexPath) {
+        
+        // This will cancel all unfinished downloading task when the cell disappearing.
         (cell as! CollectionViewCell).cellImageView.kf_cancelDownloadTask()
     }
     

+ 4 - 0
Kingfisher/UIImageView+Kingfisher.swift

@@ -274,6 +274,10 @@ public extension UIImageView {
 }
 
 extension UIImageView {
+    /**
+     Cancel the image download task bounded to the image view if it is running.
+     Nothing will happen if the downloading has already finished.
+     */
     public func kf_cancelDownloadTask() {
         kf_imageTask?.downloadTask?.cancel()
     }