FLAnimatedImageView+WebCache.h 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. /*
  2. * This file is part of the SDWebImage package.
  3. * (c) Olivier Poitrey <rs@dailymotion.com>
  4. *
  5. * For the full copyright and license information, please view the LICENSE
  6. * file that was distributed with this source code.
  7. */
  8. #import "SDWebImageCompat.h"
  9. #if SD_UIKIT
  10. #if __has_include(<FLAnimatedImage/FLAnimatedImage.h>)
  11. #import <FLAnimatedImage/FLAnimatedImage.h>
  12. #else
  13. #import "FLAnimatedImageView.h"
  14. #endif
  15. #import "SDWebImageManager.h"
  16. /**
  17. * A category for the FLAnimatedImage imageView class that hooks it to the SDWebImage system.
  18. * Very similar to the base class category (UIImageView (WebCache))
  19. */
  20. @interface FLAnimatedImageView (WebCache)
  21. /**
  22. * Load the image at the given url (either from cache or download) and load it in this imageView. It works with both static and dynamic images
  23. * The download is asynchronous and cached.
  24. *
  25. * @param url The url for the image.
  26. */
  27. - (void)sd_setImageWithURL:(nullable NSURL *)url NS_REFINED_FOR_SWIFT;
  28. /**
  29. * Load the image at the given url (either from cache or download) and load it in this imageView. It works with both static and dynamic images
  30. * The download is asynchronous and cached.
  31. * Uses a placeholder until the request finishes.
  32. *
  33. * @param url The url for the image.
  34. * @param placeholder The image to be set initially, until the image request finishes.
  35. */
  36. - (void)sd_setImageWithURL:(nullable NSURL *)url
  37. placeholderImage:(nullable UIImage *)placeholder NS_REFINED_FOR_SWIFT;
  38. /**
  39. * Load the image at the given url (either from cache or download) and load it in this imageView. It works with both static and dynamic images
  40. * The download is asynchronous and cached.
  41. * Uses a placeholder until the request finishes.
  42. *
  43. * @param url The url for the image.
  44. * @param placeholder The image to be set initially, until the image request finishes.
  45. * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values.
  46. */
  47. - (void)sd_setImageWithURL:(nullable NSURL *)url
  48. placeholderImage:(nullable UIImage *)placeholder
  49. options:(SDWebImageOptions)options NS_REFINED_FOR_SWIFT;
  50. /**
  51. * Load the image at the given url (either from cache or download) and load it in this imageView. It works with both static and dynamic images
  52. * The download is asynchronous and cached.
  53. *
  54. * @param url The url for the image.
  55. * @param completedBlock A block called when operation has been completed. This block has no return value
  56. * and takes the requested UIImage as first parameter. In case of error the image parameter
  57. * is nil and the second parameter may contain an NSError. The third parameter is a Boolean
  58. * indicating if the image was retrieved from the local cache or from the network.
  59. * The fourth parameter is the original image url.
  60. */
  61. - (void)sd_setImageWithURL:(nullable NSURL *)url
  62. completed:(nullable SDExternalCompletionBlock)completedBlock;
  63. /**
  64. * Load the image at the given url (either from cache or download) and load it in this imageView. It works with both static and dynamic images
  65. * The download is asynchronous and cached.
  66. * Uses a placeholder until the request finishes.
  67. *
  68. * @param url The url for the image.
  69. * @param placeholder The image to be set initially, until the image request finishes.
  70. * @param completedBlock A block called when operation has been completed. This block has no return value
  71. * and takes the requested UIImage as first parameter. In case of error the image parameter
  72. * is nil and the second parameter may contain an NSError. The third parameter is a Boolean
  73. * indicating if the image was retrieved from the local cache or from the network.
  74. * The fourth parameter is the original image url.
  75. */
  76. - (void)sd_setImageWithURL:(nullable NSURL *)url
  77. placeholderImage:(nullable UIImage *)placeholder
  78. completed:(nullable SDExternalCompletionBlock)completedBlock NS_REFINED_FOR_SWIFT;
  79. /**
  80. * Load the image at the given url (either from cache or download) and load it in this imageView. It works with both static and dynamic images
  81. * The download is asynchronous and cached.
  82. * Uses a placeholder until the request finishes.
  83. *
  84. * @param url The url for the image.
  85. * @param placeholder The image to be set initially, until the image request finishes.
  86. * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values.
  87. * @param completedBlock A block called when operation has been completed. This block has no return value
  88. * and takes the requested UIImage as first parameter. In case of error the image parameter
  89. * is nil and the second parameter may contain an NSError. The third parameter is a Boolean
  90. * indicating if the image was retrieved from the local cache or from the network.
  91. * The fourth parameter is the original image url.
  92. */
  93. - (void)sd_setImageWithURL:(nullable NSURL *)url
  94. placeholderImage:(nullable UIImage *)placeholder
  95. options:(SDWebImageOptions)options
  96. completed:(nullable SDExternalCompletionBlock)completedBlock;
  97. /**
  98. * Load the image at the given url (either from cache or download) and load it in this imageView. It works with both static and dynamic images
  99. * The download is asynchronous and cached.
  100. * Uses a placeholder until the request finishes.
  101. *
  102. * @param url The url for the image.
  103. * @param placeholder The image to be set initially, until the image request finishes.
  104. * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values.
  105. * @param progressBlock A block called while image is downloading
  106. * @note the progress block is executed on a background queue
  107. * @param completedBlock A block called when operation has been completed. This block has no return value
  108. * and takes the requested UIImage as first parameter. In case of error the image parameter
  109. * is nil and the second parameter may contain an NSError. The third parameter is a Boolean
  110. * indicating if the image was retrieved from the local cache or from the network.
  111. * The fourth parameter is the original image url.
  112. */
  113. - (void)sd_setImageWithURL:(nullable NSURL *)url
  114. placeholderImage:(nullable UIImage *)placeholder
  115. options:(SDWebImageOptions)options
  116. progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock
  117. completed:(nullable SDExternalCompletionBlock)completedBlock;
  118. @end
  119. #endif