UIImageView+HighlightedWebCache.h 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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. #import "SDWebImageManager.h"
  11. /**
  12. * Integrates SDWebImage async downloading and caching of remote images with UIImageView for highlighted state.
  13. */
  14. @interface UIImageView (HighlightedWebCache)
  15. /**
  16. * Set the imageView `highlightedImage` with an `url`.
  17. *
  18. * The download is asynchronous and cached.
  19. *
  20. * @param url The url for the image.
  21. */
  22. - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url NS_REFINED_FOR_SWIFT;
  23. /**
  24. * Set the imageView `highlightedImage` with an `url` and custom options.
  25. *
  26. * The download is asynchronous and cached.
  27. *
  28. * @param url The url for the image.
  29. * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values.
  30. */
  31. - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url
  32. options:(SDWebImageOptions)options NS_REFINED_FOR_SWIFT;
  33. /**
  34. * Set the imageView `highlightedImage` with an `url`, custom options and context.
  35. *
  36. * The download is asynchronous and cached.
  37. *
  38. * @param url The url for the image.
  39. * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values.
  40. * @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold.
  41. */
  42. - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url
  43. options:(SDWebImageOptions)options
  44. context:(nullable SDWebImageContext *)context;
  45. /**
  46. * Set the imageView `highlightedImage` with an `url`.
  47. *
  48. * The download is asynchronous and cached.
  49. *
  50. * @param url The url for the image.
  51. * @param completedBlock A block called when operation has been completed. This block has no return value
  52. * and takes the requested UIImage as first parameter. In case of error the image parameter
  53. * is nil and the second parameter may contain an NSError. The third parameter is a Boolean
  54. * indicating if the image was retrieved from the local cache or from the network.
  55. * The fourth parameter is the original image url.
  56. */
  57. - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url
  58. completed:(nullable SDExternalCompletionBlock)completedBlock NS_REFINED_FOR_SWIFT;
  59. /**
  60. * Set the imageView `highlightedImage` with an `url` and custom options.
  61. *
  62. * The download is asynchronous and cached.
  63. *
  64. * @param url The url for the image.
  65. * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values.
  66. * @param completedBlock A block called when operation has been completed. This block has no return value
  67. * and takes the requested UIImage as first parameter. In case of error the image parameter
  68. * is nil and the second parameter may contain an NSError. The third parameter is a Boolean
  69. * indicating if the image was retrieved from the local cache or from the network.
  70. * The fourth parameter is the original image url.
  71. */
  72. - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url
  73. options:(SDWebImageOptions)options
  74. completed:(nullable SDExternalCompletionBlock)completedBlock;
  75. /**
  76. * Set the imageView `highlightedImage` with an `url` and custom options.
  77. *
  78. * The download is asynchronous and cached.
  79. *
  80. * @param url The url for the image.
  81. * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values.
  82. * @param progressBlock A block called while image is downloading
  83. * @note the progress block is executed on a background queue
  84. * @param completedBlock A block called when operation has been completed. This block has no return value
  85. * and takes the requested UIImage as first parameter. In case of error the image parameter
  86. * is nil and the second parameter may contain an NSError. The third parameter is a Boolean
  87. * indicating if the image was retrieved from the local cache or from the network.
  88. * The fourth parameter is the original image url.
  89. */
  90. - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url
  91. options:(SDWebImageOptions)options
  92. progress:(nullable SDImageLoaderProgressBlock)progressBlock
  93. completed:(nullable SDExternalCompletionBlock)completedBlock;
  94. /**
  95. * Set the imageView `highlightedImage` with an `url`, custom options and context.
  96. *
  97. * The download is asynchronous and cached.
  98. *
  99. * @param url The url for the image.
  100. * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values.
  101. * @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold.
  102. * @param progressBlock A block called while image is downloading
  103. * @note the progress block is executed on a background queue
  104. * @param completedBlock A block called when operation has been completed. This block has no return value
  105. * and takes the requested UIImage as first parameter. In case of error the image parameter
  106. * is nil and the second parameter may contain an NSError. The third parameter is a Boolean
  107. * indicating if the image was retrieved from the local cache or from the network.
  108. * The fourth parameter is the original image url.
  109. */
  110. - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url
  111. options:(SDWebImageOptions)options
  112. context:(nullable SDWebImageContext *)context
  113. progress:(nullable SDImageLoaderProgressBlock)progressBlock
  114. completed:(nullable SDExternalCompletionBlock)completedBlock;
  115. @end
  116. #endif