MKAnnotationView+WebCache.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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 || SD_MAC
  10. #import <MapKit/MapKit.h>
  11. #import "SDWebImageManager.h"
  12. /**
  13. * Integrates SDWebImage async downloading and caching of remote images with MKAnnotationView.
  14. */
  15. @interface MKAnnotationView (WebCache)
  16. /**
  17. * Set the imageView `image` with an `url`.
  18. *
  19. * The download is asynchronous and cached.
  20. *
  21. * @param url The url for the image.
  22. */
  23. - (void)sd_setImageWithURL:(nullable NSURL *)url NS_REFINED_FOR_SWIFT;
  24. /**
  25. * Set the imageView `image` with an `url` and a placeholder.
  26. *
  27. * The download is asynchronous and cached.
  28. *
  29. * @param url The url for the image.
  30. * @param placeholder The image to be set initially, until the image request finishes.
  31. * @see sd_setImageWithURL:placeholderImage:options:
  32. */
  33. - (void)sd_setImageWithURL:(nullable NSURL *)url
  34. placeholderImage:(nullable UIImage *)placeholder NS_REFINED_FOR_SWIFT;
  35. /**
  36. * Set the imageView `image` with an `url`, placeholder and custom options.
  37. *
  38. * The download is asynchronous and cached.
  39. *
  40. * @param url The url for the image.
  41. * @param placeholder The image to be set initially, until the image request finishes.
  42. * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values.
  43. */
  44. - (void)sd_setImageWithURL:(nullable NSURL *)url
  45. placeholderImage:(nullable UIImage *)placeholder
  46. options:(SDWebImageOptions)options NS_REFINED_FOR_SWIFT;
  47. /**
  48. * Set the imageView `image` with an `url`.
  49. *
  50. * The download is asynchronous and cached.
  51. *
  52. * @param url The url for the image.
  53. * @param completedBlock A block called when operation has been completed. This block has no return value
  54. * and takes the requested UIImage as first parameter. In case of error the image parameter
  55. * is nil and the second parameter may contain an NSError. The third parameter is a Boolean
  56. * indicating if the image was retrieved from the local cache or from the network.
  57. * The fourth parameter is the original image url.
  58. */
  59. - (void)sd_setImageWithURL:(nullable NSURL *)url
  60. completed:(nullable SDExternalCompletionBlock)completedBlock;
  61. /**
  62. * Set the imageView `image` with an `url`, placeholder.
  63. *
  64. * The download is asynchronous and cached.
  65. *
  66. * @param url The url for the image.
  67. * @param placeholder The image to be set initially, until the image request finishes.
  68. * @param completedBlock A block called when operation has been completed. This block has no return value
  69. * and takes the requested UIImage as first parameter. In case of error the image parameter
  70. * is nil and the second parameter may contain an NSError. The third parameter is a Boolean
  71. * indicating if the image was retrieved from the local cache or from the network.
  72. * The fourth parameter is the original image url.
  73. */
  74. - (void)sd_setImageWithURL:(nullable NSURL *)url
  75. placeholderImage:(nullable UIImage *)placeholder
  76. completed:(nullable SDExternalCompletionBlock)completedBlock NS_REFINED_FOR_SWIFT;
  77. /**
  78. * Set the imageView `image` with an `url`, placeholder and custom options.
  79. *
  80. * The download is asynchronous and cached.
  81. *
  82. * @param url The url for the image.
  83. * @param placeholder The image to be set initially, until the image request finishes.
  84. * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values.
  85. * @param completedBlock A block called when operation has been completed. This block has no return value
  86. * and takes the requested UIImage as first parameter. In case of error the image parameter
  87. * is nil and the second parameter may contain an NSError. The third parameter is a Boolean
  88. * indicating if the image was retrieved from the local cache or from the network.
  89. * The fourth parameter is the original image url.
  90. */
  91. - (void)sd_setImageWithURL:(nullable NSURL *)url
  92. placeholderImage:(nullable UIImage *)placeholder
  93. options:(SDWebImageOptions)options
  94. completed:(nullable SDExternalCompletionBlock)completedBlock;
  95. @end
  96. #endif