FWImagePickerController
@interface FWImagePickerController : UIViewController <UICollectionViewDataSource, UICollectionViewDelegate, FWImagePickerPreviewControllerDelegate>
@property(nullable, nonatomic, weak) id<FWImagePickerControllerDelegate> imagePickerControllerDelegate;
/// 自定义预览控制器句柄,优先级低于delegate
@property(nullable, nonatomic, copy) FWImagePickerPreviewController * (^previewControllerBlock)(void);
/// 自定义相册控制器句柄,优先级低于delegate
@property(nullable, nonatomic, copy) FWImageAlbumController * (^albumControllerBlock)(void);
/// 自定义cell展示句柄,cellForItem自动调用,优先级低于delegate
@property(nullable, nonatomic, copy) void (^customCellBlock)(FWImagePickerCollectionCell *cell, NSIndexPath *indexPath);
/// 图片选取完成回调句柄,优先级低于delegate
@property(nullable, nonatomic, copy) void (^didFinishPicking)(NSArray<FWAsset *> *imagesAssetArray);
/// 图片选取取消回调句柄,优先级低于delegate
@property(nullable, nonatomic, copy) void (^didCancelPicking)(void);
@property(nullable, nonatomic, strong) UIColor *toolBarBackgroundColor;
@property(nullable, nonatomic, strong) UIColor *toolBarTintColor;
/// 当前titleView,默认不可点击,contentType方式会自动切换点击状态
@property(nonatomic, strong, readonly) FWToolbarTitleView *titleView;
/// 标题视图accessoryImage,默认nil,contentType方式会自动设置
@property(nullable, nonatomic, strong) UIImage *titleAccessoryImage;
/*
* 图片的最小尺寸,布局时如果有剩余空间,会将空间分配给图片大小,所以最终显示出来的大小不一定等于minimumImageWidth。默认是75。
* @warning collectionViewLayout 和 collectionView 可能有设置 sectionInsets 和 contentInsets,所以设置几行不可以简单的通过 screenWdith / columnCount 来获得
*/
@property(nonatomic, assign) CGFloat minimumImageWidth;
/// 图片显示列数,默认0使用minimumImageWidth自动计算,指定后固定列数
@property(nonatomic, assign) NSInteger imageColumnCount;
@property(nonatomic, strong, readonly) UICollectionViewFlowLayout *collectionViewLayout;
@property(nonatomic, strong, readonly) UICollectionView *collectionView;
@property(nonatomic, strong, readonly) UIView *operationToolBarView;
/// 自定义工具栏高度,默认同系统
@property(nonatomic, assign) CGFloat operationToolBarHeight;
@property(nonatomic, assign) CGFloat toolBarPaddingHorizontal;
@property(nonatomic, strong, readonly) UIButton *previewButton;
@property(nonatomic, strong, readonly) UIButton *sendButton;
/// 也可以直接传入 FWAssetGroup,然后读取其中的 FWAsset 并储存到 imagesAssetArray 中,传入后会赋值到 FWAssetGroup,并自动刷新 UI 展示
- (void)refreshWithAssetsGroup:(FWAssetGroup * _Nullable)assetsGroup;
/// 根据filterType刷新,自动选取第一个符合条件的相册,自动初始化并使用albumController
- (void)refreshWithFilterType:(FWImagePickerFilterType)filterType;
@property(nullable, nonatomic, strong, readonly) NSMutableArray<FWAsset *> *imagesAssetArray;
@property(nullable, nonatomic, strong, readonly) FWAssetGroup *assetsGroup;
/// 图片过滤类型,默认0不过滤,影响requestImage结果和previewController预览效果
@property(nonatomic, assign) FWImagePickerFilterType filterType;
/// 当前被选择的图片对应的 FWAsset 对象数组
@property(nullable, nonatomic, strong, readonly) NSMutableArray<FWAsset *> *selectedImageAssetArray;
/// 是否允许图片多选,默认为 YES。如果为 NO,则不显示 checkbox 和底部工具栏
@property(nonatomic, assign) BOOL allowsMultipleSelection;
/// 是否禁用预览时左右滚动,默认NO。如果为YES,单选时不能左右滚动切换图片
@property(nonatomic, assign) BOOL previewScrollDisabled;
/// 最多可以选择的图片数,默认为9
@property(nonatomic, assign) NSUInteger maximumSelectImageCount;
/// 最少需要选择的图片数,默认为 0
@property(nonatomic, assign) NSUInteger minimumSelectImageCount;
/// 是否显示默认loading,优先级低于delegate,默认YES
@property(nonatomic, assign) BOOL showsDefaultLoading;
/// 是否需要请求图片资源,默认NO,开启后会先requestImagesAssetArray再回调didFinishPicking
@property(nonatomic, assign) BOOL shouldRequestImage;
/// 图片过滤类型转换为相册内容类型
+ (FWAlbumContentType)albumContentTypeWithFilterType:(FWImagePickerFilterType)filterType;
/**
* 检查并下载一组资源,如果资源仍未从 iCloud 中成功下载,则会发出请求从 iCloud 加载资源,下载完成后,主线程回调。
* 图片资源对象和结果信息保存在FWAsset.requestObject,自动根据过滤类型返回UIImage|PHLivePhoto|NSURL
*/
+ (void)requestImagesAssetArray:(NSArray<FWAsset *> *)imagesAssetArray
filterType:(FWImagePickerFilterType)filterType
useOrigin:(BOOL)useOrigin
completion:(nullable void (^)(void))completion;
@end
Undocumented
-
Undocumented
Declaration
Objective-C
@property(nullable, nonatomic, weak) id<FWImagePickerControllerDelegate> imagePickerControllerDelegate
-
自定义预览控制器句柄,优先级低于delegate
Declaration
Objective-C
@property (nonatomic, copy, nullable) FWImagePickerPreviewController *_Nonnull (^)(void) previewControllerBlock;
-
自定义相册控制器句柄,优先级低于delegate
Declaration
Objective-C
@property (nonatomic, copy, nullable) FWImageAlbumController *_Nonnull (^)(void) albumControllerBlock;
-
自定义cell展示句柄,cellForItem自动调用,优先级低于delegate
Declaration
Objective-C
@property (nonatomic, copy, nullable) void (^) (FWImagePickerCollectionCell *_Nonnull __strong, NSIndexPath *_Nonnull __strong) customCellBlock;
-
图片选取完成回调句柄,优先级低于delegate
Declaration
Objective-C
@property (nonatomic, copy, nullable) void (^) (NSArray<FWAsset *> *_Nonnull __strong) didFinishPicking;
-
图片选取取消回调句柄,优先级低于delegate
Declaration
Objective-C
@property (nonatomic, copy, nullable) void (^)(void) didCancelPicking;
-
Undocumented
Declaration
Objective-C
@property(nullable, nonatomic, strong) UIColor *toolBarBackgroundColor
-
Undocumented
Declaration
Objective-C
@property(nullable, nonatomic, strong) UIColor *toolBarTintColor
-
当前titleView,默认不可点击,contentType方式会自动切换点击状态
Declaration
Objective-C
@property (nonatomic, strong, readonly) FWToolbarTitleView *_Nonnull titleView;
-
标题视图accessoryImage,默认nil,contentType方式会自动设置
Declaration
Objective-C
@property (nonatomic, strong, nullable) UIImage *titleAccessoryImage;
-
Undocumented
Declaration
Objective-C
@property(nonatomic, assign) CGFloat minimumImageWidth
-
图片显示列数,默认0使用minimumImageWidth自动计算,指定后固定列数
Declaration
Objective-C
@property (nonatomic) NSInteger imageColumnCount;
-
Undocumented
Declaration
Objective-C
@property(nonatomic, strong, readonly) UICollectionViewFlowLayout *collectionViewLayout
-
Undocumented
Declaration
Objective-C
@property(nonatomic, strong, readonly) UICollectionView *collectionView
-
Undocumented
Declaration
Objective-C
@property(nonatomic, strong, readonly) UIView *operationToolBarView
-
自定义工具栏高度,默认同系统
Declaration
Objective-C
@property (nonatomic) CGFloat operationToolBarHeight;
-
Undocumented
Declaration
Objective-C
@property(nonatomic, assign) CGFloat toolBarPaddingHorizontal
-
Undocumented
Declaration
Objective-C
@property(nonatomic, strong, readonly) UIButton *previewButton
-
Undocumented
Declaration
Objective-C
@property(nonatomic, strong, readonly) UIButton *sendButton
-
也可以直接传入 FWAssetGroup,然后读取其中的 FWAsset 并储存到 imagesAssetArray 中,传入后会赋值到 FWAssetGroup,并自动刷新 UI 展示
Declaration
Objective-C
- (void)refreshWithAssetsGroup:(FWAssetGroup *_Nullable)assetsGroup;
-
根据filterType刷新,自动选取第一个符合条件的相册,自动初始化并使用albumController
Declaration
Objective-C
- (void)refreshWithFilterType:(FWImagePickerFilterType)filterType;
-
Undocumented
Declaration
Objective-C
@property(nullable, nonatomic, strong, readonly) NSMutableArray<FWAsset *> *imagesAssetArray
-
Undocumented
Declaration
Objective-C
@property(nullable, nonatomic, strong, readonly) FWAssetGroup *assetsGroup
-
图片过滤类型,默认0不过滤,影响requestImage结果和previewController预览效果
Declaration
Objective-C
@property (nonatomic) FWImagePickerFilterType filterType;
-
当前被选择的图片对应的 FWAsset 对象数组
Declaration
Objective-C
@property (nonatomic, strong, readonly, nullable) NSMutableArray<FWAsset *> *selectedImageAssetArray;
-
是否允许图片多选,默认为 YES。如果为 NO,则不显示 checkbox 和底部工具栏
Declaration
Objective-C
@property (nonatomic) BOOL allowsMultipleSelection;
-
是否禁用预览时左右滚动,默认NO。如果为YES,单选时不能左右滚动切换图片
Declaration
Objective-C
@property (nonatomic) BOOL previewScrollDisabled;
-
最多可以选择的图片数,默认为9
Declaration
Objective-C
@property (nonatomic) NSUInteger maximumSelectImageCount;
-
最少需要选择的图片数,默认为 0
Declaration
Objective-C
@property (nonatomic) NSUInteger minimumSelectImageCount;
-
是否显示默认loading,优先级低于delegate,默认YES
Declaration
Objective-C
@property (nonatomic) BOOL showsDefaultLoading;
-
是否需要请求图片资源,默认NO,开启后会先requestImagesAssetArray再回调didFinishPicking
Declaration
Objective-C
@property (nonatomic) BOOL shouldRequestImage;
-
图片过滤类型转换为相册内容类型
Declaration
Objective-C
+ (FWAlbumContentType)albumContentTypeWithFilterType: (FWImagePickerFilterType)filterType;
-
检查并下载一组资源,如果资源仍未从 iCloud 中成功下载,则会发出请求从 iCloud 加载资源,下载完成后,主线程回调。 图片资源对象和结果信息保存在FWAsset.requestObject,自动根据过滤类型返回UIImage|PHLivePhoto|NSURL
Declaration
Objective-C
+ (void)requestImagesAssetArray:(nonnull NSArray<FWAsset *> *)imagesAssetArray filterType:(FWImagePickerFilterType)filterType useOrigin:(BOOL)useOrigin completion:(nullable void (^)(void))completion;