123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- //
- // SelectImageHandler.h
- // Starbuds
- //
- // Created by 翟玉磊 on 2020/1/7.
- // Copyright © 2020 翟玉磊. All rights reserved.
- // 此类只处理本地图片的选择和浏览 视频和gif图片没有添加处理方法
- #import <Foundation/Foundation.h>
- NS_ASSUME_NONNULL_BEGIN
- @protocol SelectImageHandlerDelegate <NSObject>
- @optional
- /// 选择回调
- - (void)didFinishPickingPhotos:(NSArray<UIImage *>*)photos sourceAssets:(NSArray *)assets isSelectOriginalPhoto:(BOOL)isSelectOriginalPhoto;
- /// 预览回调
- - (void)previewImageDidFinishPhotos:(NSArray<UIImage *>*)photos sourceAssets:(NSArray *)assets isSelectOriginalPhoto:(BOOL)isSelectOriginalPhoto;
- @end
- @interface SelectImageHandler : NSObject
- @property (nonatomic, readwrite, weak) id<SelectImageHandlerDelegate>delegate;
- /// 父控制器
- @property (nonatomic, readwrite, strong) UIViewController *parentController;
- /// Default is 9 / 默认最大可选9张图片
- @property (nonatomic, readwrite, assign) NSInteger maxImagesCount;
- #pragma mark — ------单选模式------
- /// 单选模式,maxImagesCount为1时才生效
- @property (nonatomic, assign) BOOL showSelectBtn; ///< 在单选模式下,照片列表页中,显示选择按钮,默认为NO
- @property (nonatomic, assign) BOOL allowCrop; ///< 允许裁剪,默认为YES,showSelectBtn为NO才生效
- /// 是否圆形裁剪 默认NO不进行圆形裁剪 只有allowCropSwitch为YES时才有效
- @property (nonatomic, readwrite, assign) BOOL needCircleCrop;
- /// 是否正方形裁剪
- @property (nonatomic, assign) BOOL allowSquareCrop;
- /// 是否横图裁剪
- @property (nonatomic, assign) BOOL allowHorizontalCrop;
- #pragma mark — ------单选模式------
- /// 显示图片选择控制器
- /// @param maxCount 能选择的最大数量
- /// @param parentController 父控制器且支持代理
- - (void)showImagePickerControllerWithMaxCount:(NSInteger)maxCount parentController:(UIViewController*)parentController;
- /// 预览图片
- /// @param selectedPhotos 选中的图片数组
- /// @param selectedAssets 选中图片数组的相册数据
- /// @param index 选中的索引
- /// @param parentController 父控制器
- - (void)previewImagePickerWithSelectedPhotos:(NSArray *)selectedPhotos selectedAssets:(NSArray *)selectedAssets index:(NSInteger)index parentController:(UIViewController*)parentController;
- @end
- NS_ASSUME_NONNULL_END
|