XHWebImageAutoSize.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. //
  2. // XHWebImageAutoSize.h
  3. // XHWebImageHeightLayoutExample
  4. //
  5. // Created by zhuxiaohui on 2016/11/16.
  6. // Copyright © 2016年 it7090.com. All rights reserved.
  7. // https://github.com/CoderZhuXH/XHWebImageAutoSize
  8. // 版本:1.1.2
  9. // 如果你在使用过程中出现bug,请及时以下面任意一种方式联系我,我会及时修复bug并帮您解决问题。
  10. // QQ交流群:537476189
  11. // Email:it7090@163.com
  12. // 新浪微博:朱晓辉Allen
  13. // GitHub:https://github.com/CoderZhuXH
  14. // 简书:https://www.jianshu.com/u/acf1a1f12e0f
  15. // 掘金:https://juejin.im/user/59b50d3cf265da066d331a06
  16. // 使用说明:https://github.com/CoderZhuXH/XHWebImageAutoSize/blob/master/README.md
  17. #import <Foundation/Foundation.h>
  18. #import <UIKit/UIKit.h>
  19. #import "UITableView+XHWebImageAutoSize.h"
  20. #import "UICollectionView+XHWebImageAutoSize.h"
  21. #import "XHWebImageAutoSizeCache.h"
  22. NS_ASSUME_NONNULL_BEGIN
  23. @interface XHWebImageAutoSize : NSObject
  24. /**
  25. * Get image height
  26. *
  27. * @param url imageURL
  28. * @param layoutWidth layoutWidth
  29. * @param estimateHeight estimateHeight(default 100)
  30. *
  31. * @return imageHeight
  32. */
  33. +(CGFloat)imageHeightForURL:(NSURL *)url layoutWidth:(CGFloat)layoutWidth estimateHeight:(CGFloat )estimateHeight;
  34. /**
  35. * Get image width
  36. *
  37. * @param url imageURL
  38. * @param layoutHeight layoutHeight
  39. * @param estimateWidth estimateWidth(default 90)
  40. *
  41. * @return imageHeight
  42. */
  43. +(CGFloat)imageWidthForURL:(NSURL *)url layoutHeight:(CGFloat)layoutHeight estimateWidth:(CGFloat )estimateWidth;
  44. /**
  45. * Get image size from cache,query the disk cache synchronously after checking the memory cache
  46. *
  47. * @param url imageURL
  48. *
  49. * @return imageSize
  50. */
  51. +(CGSize )imageSizeFromCacheForURL:(NSURL *)url;
  52. /**
  53. * Store an imageSize into memory and disk cache
  54. *
  55. * @param image image
  56. * @param url imageURL
  57. * @param completedBlock An block that should be executed after the imageSize has been saved (optional)
  58. */
  59. +(void)storeImageSize:(UIImage *)image forURL:(NSURL *)url completed:(nullable XHWebImageAutoSizeCacheCompletionBlock)completedBlock;
  60. /**
  61. * Get reload state from cache,query the disk cache synchronously after checking the memory cache
  62. *
  63. * @param url imageURL
  64. *
  65. * @return reloadState
  66. */
  67. +(BOOL)reloadStateFromCacheForURL:(NSURL *)url;
  68. /**
  69. * Store an reloadState into memory and disk cache
  70. *
  71. * @param state reloadState
  72. * @param url imageURL
  73. * @param completedBlock An block that should be executed after the reloadState has been saved (optional)
  74. */
  75. +(void)storeReloadState:(BOOL)state forURL:(NSURL *)url completed:(nullable XHWebImageAutoSizeCacheCompletionBlock)completedBlock;
  76. @end
  77. NS_ASSUME_NONNULL_END