XG_AssetPickerManager.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. //
  2. // XG_AssetPickerManager.h
  3. // MyApp
  4. //
  5. // Created by huxinguang on 2018/9/26.
  6. // Copyright © 2018年 huxinguang. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import <UIKit/UIKit.h>
  10. #import <AVFoundation/AVFoundation.h>
  11. #import <Photos/Photos.h>
  12. typedef NS_ENUM(NSUInteger,XG_AuthorizationStatus) {
  13. XG_AuthorizationStatusNotDetermined = 0,
  14. XG_AuthorizationStatusRestricted,
  15. XG_AuthorizationStatusDenied,
  16. XG_AuthorizationStatusAuthorized
  17. };
  18. @class XG_AlbumModel,XG_AssetModel;
  19. @interface XG_AssetPickerManager : NSObject
  20. @property(nonatomic, strong) PHFetchResult<PHAssetCollection *> *smartAlbums; //系统自带相册
  21. @property(nonatomic, strong) PHFetchResult<PHCollection *> *userCollections; //其他app相册或用户创建的相册
  22. + (instancetype)manager;
  23. - (void)handleAuthorizationWithCompletion:(void (^)(XG_AuthorizationStatus aStatus))completion;
  24. // 获取相册数组(get albums)
  25. - (void)getAllAlbums:(BOOL)allowPickingVideo completion:(void (^)(NSArray<XG_AlbumModel *> *models))completion;
  26. // 获取Asset (get assets)
  27. - (void)getPostImageWithAlbumModel:(XG_AlbumModel *)model completion:(void (^)(UIImage *postImage))completion;
  28. - (void)getPhotoWithAsset:(PHAsset *)asset completion:(void (^)(id photo,NSDictionary *info))completion;
  29. - (void)getPhotoWithAsset:(PHAsset *)asset photoWidth:(CGFloat)photoWidth completion:(void (^)(UIImage *photo,NSDictionary *info))completion;
  30. - (void)getPhotoWithAsset1:(PHAsset *)asset completion:(void (^)(UIImage *photo,NSDictionary *info))completion;
  31. // 获取视频(get video)
  32. - (void)getVideoWithAsset:(PHAsset *)asset completion:(void (^)(AVPlayerItem * playerItem, NSDictionary * info))completion;
  33. @end