HXPhotoViewController.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. //
  2. // HXPhotoViewController.h
  3. // HXPhotoPickerExample
  4. //
  5. // Created by Silence on 2017/10/14.
  6. // Copyright © 2017年 Silence. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. #import "HXPhotoManager.h"
  10. #import "HXCustomCollectionReusableView.h"
  11. #import "HXPhotoLimitView.h"
  12. #import "HXPickerResult.h"
  13. @class
  14. HXPhotoViewController ,
  15. HXPhotoViewCell ,
  16. HXPhotoBottomView ,
  17. HXCustomPreviewView ,
  18. HXAlbumListViewController,
  19. HXCustomCameraController;
  20. @protocol HXPhotoViewControllerDelegate <NSObject>
  21. @optional
  22. /**
  23. 点击取消
  24. @param photoViewController self
  25. */
  26. - (void)photoViewControllerDidCancel:(HXPhotoViewController *)photoViewController;
  27. /**
  28. 点击完成按钮
  29. @param photoViewController self
  30. @param allList 已选的所有列表(包含照片、视频)
  31. @param photoList 已选的照片列表
  32. @param videoList 已选的视频列表
  33. @param original 是否原图
  34. */
  35. - (void)photoViewController:(HXPhotoViewController *)photoViewController
  36. didDoneAllList:(NSArray<HXPhotoModel *> *)allList
  37. photos:(NSArray<HXPhotoModel *> *)photoList
  38. videos:(NSArray<HXPhotoModel *> *)videoList
  39. original:(BOOL)original;
  40. - (void)photoViewController:(HXPhotoViewController *)photoViewController
  41. didDoneWithResult:(HXPickerResult *)result;
  42. /**
  43. 改变了选择
  44. @param model 改的模型
  45. @param selected 是否选中
  46. */
  47. - (void)photoViewControllerDidChangeSelect:(HXPhotoModel *)model
  48. selected:(BOOL)selected;
  49. - (void)photoViewControllerFinishDismissCompletion:(HXPhotoViewController *)photoViewController;
  50. - (void)photoViewControllerCancelDismissCompletion:(HXPhotoViewController *)photoViewController;
  51. @end
  52. @interface HXPhotoViewController : UIViewController
  53. @property (copy, nonatomic) viewControllerDidDoneBlock doneBlock;
  54. @property (copy, nonatomic) viewControllerDidCancelBlock cancelBlock;
  55. @property (weak, nonatomic) id<HXPhotoViewControllerDelegate> delegate;
  56. @property (strong, nonatomic) HXPhotoManager *manager;
  57. @property (strong, nonatomic) HXAlbumModel *albumModel;
  58. @property (strong, nonatomic) HXPhotoBottomView *bottomView;
  59. @property (strong, nonatomic) HXPhotoLimitView *limitView;
  60. - (HXPhotoViewCell *)currentPreviewCell:(HXPhotoModel *)model;
  61. - (BOOL)scrollToModel:(HXPhotoModel *)model;
  62. - (void)scrollToPoint:(HXPhotoViewCell *)cell rect:(CGRect)rect;
  63. - (void)startGetAllPhotoModel;
  64. @end
  65. @protocol HXPhotoViewCellDelegate <NSObject>
  66. @optional
  67. - (void)photoViewCell:(HXPhotoViewCell *)cell didSelectBtn:(UIButton *)selectBtn;
  68. - (void)photoViewCellRequestICloudAssetComplete:(HXPhotoViewCell *)cell;
  69. @end
  70. @interface HXPhotoViewCell : UICollectionViewCell
  71. @property (weak, nonatomic) id<HXPhotoViewCellDelegate> delegate;
  72. @property (assign, nonatomic) NSInteger section;
  73. @property (assign, nonatomic) NSInteger item;
  74. @property (assign, nonatomic) BOOL canSelect;
  75. @property (strong, nonatomic, readonly) UIImageView *imageView;
  76. @property (strong, nonatomic) CALayer *selectMaskLayer;
  77. @property (strong, nonatomic) HXPhotoModel *model;
  78. @property (assign, nonatomic) BOOL singleSelected;
  79. @property (strong, nonatomic) UIColor *selectBgColor;
  80. @property (strong, nonatomic) UIColor *selectedTitleColor;
  81. @property (strong, nonatomic) UIColor *darkSelectBgColor;
  82. @property (strong, nonatomic) UIColor *darkSelectedTitleColor;
  83. @property (strong, nonatomic, readonly) CALayer *videoMaskLayer;
  84. @property (strong, nonatomic, readonly) UIButton *selectBtn;
  85. - (void)resetNetworkImage;
  86. - (void)cancelRequest;
  87. - (void)startRequestICloudAsset;
  88. - (void)bottomViewPrepareAnimation;
  89. - (void)bottomViewStartAnimation;
  90. - (void)setModel:(HXPhotoModel *)model emptyImage:(BOOL)emptyImage;
  91. - (void)setModelDataWithHighQuality:(BOOL)highQuality completion:(void (^)(HXPhotoViewCell *myCell))completion;
  92. @end
  93. @interface HXPhotoCameraViewCell : UICollectionViewCell
  94. @property (strong, nonatomic) HXPhotoModel *model;
  95. @property (strong, nonatomic, readonly) HXCustomCameraController *cameraController;
  96. @property (strong, nonatomic) UIImage *cameraImage;
  97. @property (assign, nonatomic) BOOL cameraSelected;
  98. @property (assign, nonatomic) BOOL startSession;
  99. @property (strong, nonatomic) UIColor *bgColor;
  100. - (void)starRunning;
  101. - (void)stopRunning;
  102. @end
  103. @interface HXPhotoLimitViewCell : UICollectionViewCell
  104. @property (strong, nonatomic) UIColor *bgColor;
  105. @property (strong, nonatomic) UIColor *bgDarkColor;
  106. @property (strong, nonatomic) UIColor *lineColor;
  107. @property (strong, nonatomic) UIColor *lineDarkColor;
  108. @property (strong, nonatomic) UIColor *textColor;
  109. @property (strong, nonatomic) UIColor *textDarkColor;
  110. @property (strong, nonatomic) UIFont *textFont;
  111. - (void)config;
  112. @end
  113. @interface HXPhotoViewSectionFooterView : UICollectionReusableView
  114. @property (assign, nonatomic) NSInteger photoCount;
  115. @property (assign, nonatomic) NSInteger videoCount;
  116. @property (strong, nonatomic) UIColor *bgColor;
  117. @property (strong, nonatomic) UIColor *textColor;
  118. @end
  119. @protocol HXPhotoBottomViewDelegate <NSObject>
  120. @optional
  121. - (void)photoBottomViewDidPreviewBtn;
  122. - (void)photoBottomViewDidDoneBtn;
  123. - (void)photoBottomViewDidEditBtn;
  124. @end
  125. @interface HXPhotoBottomView : UIView
  126. @property (weak, nonatomic) id<HXPhotoBottomViewDelegate> delegate;
  127. @property (strong, nonatomic) HXPhotoManager *manager;
  128. @property (assign, nonatomic) BOOL previewBtnEnabled;
  129. @property (assign, nonatomic) BOOL doneBtnEnabled;
  130. @property (assign, nonatomic) NSInteger selectCount;
  131. @property (strong, nonatomic) UIButton *originalBtn;
  132. @property (strong, nonatomic) UIToolbar *bgView;
  133. - (void)requestPhotosBytes;
  134. @end