UIView+WebCacheOperation.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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. #import "SDWebImageOperation.h"
  10. // These methods are used to support canceling for UIView image loading, it's designed to be used internal but not external.
  11. // All the stored operations are weak, so it will be dalloced after image loading finished. If you need to store operations, use your own class to keep a strong reference for them.
  12. @interface UIView (WebCacheOperation)
  13. /**
  14. * Set the image load operation (storage in a UIView based weak map table)
  15. *
  16. * @param operation the operation
  17. * @param key key for storing the operation
  18. */
  19. - (void)sd_setImageLoadOperation:(nullable id<SDWebImageOperation>)operation forKey:(nullable NSString *)key;
  20. /**
  21. * Cancel all operations for the current UIView and key
  22. *
  23. * @param key key for identifying the operations
  24. */
  25. - (void)sd_cancelImageLoadOperationWithKey:(nullable NSString *)key;
  26. /**
  27. * Just remove the operations corresponding to the current UIView and key without cancelling them
  28. *
  29. * @param key key for identifying the operations
  30. */
  31. - (void)sd_removeImageLoadOperationWithKey:(nullable NSString *)key;
  32. @end