UGCKitMediaPickerViewController.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // Copyright (c) 2019 Tencent. All rights reserved.
  2. #import <UIKit/UIKit.h>
  3. #import <Photos/Photos.h>
  4. #import "UGCKitTheme.h"
  5. #import "UGCKitResult.h"
  6. NS_ASSUME_NONNULL_BEGIN
  7. @class UGCKitMediaPickerViewController;
  8. @protocol UGCKitMediaPickerControllerDelegate <NSObject>
  9. @optional
  10. - (BOOL)qb_imagePickerController:(UGCKitMediaPickerViewController *)imagePickerController shouldSelectAsset:(PHAsset *)asset;
  11. - (void)qb_imagePickerController:(UGCKitMediaPickerViewController *)imagePickerController didSelectAsset:(PHAsset *)asset;
  12. - (void)qb_imagePickerController:(UGCKitMediaPickerViewController *)imagePickerController didDeselectAsset:(PHAsset *)asset;
  13. @end
  14. typedef NS_OPTIONS(NSInteger, UGCKitMediaType) {
  15. UGCKitMediaTypePhoto = 1 << 0,
  16. UGCKitMediaTypeVideo = 1 << 1,
  17. UGCKitMediaTypeAny = UGCKitMediaTypePhoto | UGCKitMediaTypeVideo,
  18. };
  19. @interface UGCKitMediaPickerConfig : NSObject
  20. /// 导航栏提示,默认 nil
  21. @property (nullable, nonatomic, copy) NSString *prompt;
  22. /// 最少选取个数,默认值为1
  23. @property (assign, nonatomic) NSUInteger minItemCount;
  24. /// 最多选取个数,默认值为1
  25. @property (assign, nonatomic) NSUInteger maxItemCount;
  26. /// 选取的媒体类型,支持 PHAssetMediaTypeImage 和 PHAssetMediaTypeVideo,默认为 PHAssetMediaTypeVideo
  27. @property (assign, nonatomic) UGCKitMediaType mediaType;
  28. /// 竖屏列数,默认为4
  29. @property (nonatomic, assign) NSUInteger numberOfColumnsInPortrait;
  30. /// 横屏列数,默认为7
  31. @property (nonatomic, assign) NSUInteger numberOfColumnsInLandscape;
  32. /// 获取视频后是否拼接视频,默认为 YES
  33. @property (nonatomic, assign) BOOL combineVideos;
  34. @end
  35. @interface UGCKitMediaPickerViewController : UIViewController
  36. @property (readonly, nonatomic) UGCKitMediaPickerConfig *config;
  37. @property (copy, nonatomic) void(^completion)(UGCKitResult *result);
  38. - (instancetype)initWithConfig:(nullable UGCKitMediaPickerConfig *)config
  39. theme:(nullable UGCKitTheme *)theme;
  40. @property (nonatomic, weak) id<UGCKitMediaPickerControllerDelegate> delegate;
  41. @property (nonatomic, strong, readonly) NSMutableOrderedSet<PHAsset*> *selectedAssets;
  42. // 仅在 completion 回调时有值
  43. @property (nonatomic, strong, readonly) NSArray<AVAsset *> *exportedAssets;
  44. @property (nonatomic, copy) NSArray *assetCollectionSubtypes;
  45. @end
  46. NS_ASSUME_NONNULL_END