TZImagePickerController.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  1. //
  2. // TZImagePickerController.h
  3. // TZImagePickerController
  4. //
  5. // Created by 谭真 on 15/12/24.
  6. // Copyright © 2015年 谭真. All rights reserved.
  7. // version 3.2.1 - 2019.05.29
  8. // 更多信息,请前往项目的github地址:https://github.com/banchichen/TZImagePickerController
  9. /*
  10. 经过测试,比起xib的方式,把TZAssetCell改用纯代码的方式来写,滑动帧数明显提高了(约提高10帧左右)
  11. 最初发现这个问题并修复的是@小鱼周凌宇同学,她的博客地址: http://zhoulingyu.com/
  12. 表示感谢~
  13. 原来xib确实会导致性能问题啊...大家也要注意了...
  14. */
  15. #import <UIKit/UIKit.h>
  16. #import "TZAssetModel.h"
  17. #import "NSBundle+TZImagePicker.h"
  18. #import "TZImageManager.h"
  19. #import "TZVideoPlayerController.h"
  20. #import "TZGifPhotoPreviewController.h"
  21. #import "TZLocationManager.h"
  22. #import "TZPhotoPreviewController.h"
  23. #import "TZPhotoPreviewCell.h"
  24. @class TZAlbumCell, TZAssetCell;
  25. @protocol TZImagePickerControllerDelegate;
  26. @interface TZImagePickerController : UINavigationController
  27. #pragma mark -
  28. /// Use this init method / 用这个初始化方法
  29. - (instancetype)initWithMaxImagesCount:(NSInteger)maxImagesCount delegate:(id<TZImagePickerControllerDelegate>)delegate;
  30. - (instancetype)initWithMaxImagesCount:(NSInteger)maxImagesCount columnNumber:(NSInteger)columnNumber delegate:(id<TZImagePickerControllerDelegate>)delegate;
  31. - (instancetype)initWithMaxImagesCount:(NSInteger)maxImagesCount columnNumber:(NSInteger)columnNumber delegate:(id<TZImagePickerControllerDelegate>)delegate pushPhotoPickerVc:(BOOL)pushPhotoPickerVc;
  32. /// This init method just for previewing photos / 用这个初始化方法以预览图片
  33. - (instancetype)initWithSelectedAssets:(NSMutableArray *)selectedAssets selectedPhotos:(NSMutableArray *)selectedPhotos index:(NSInteger)index;
  34. /// This init method for crop photo / 用这个初始化方法以裁剪图片
  35. - (instancetype)initCropTypeWithAsset:(PHAsset *)asset photo:(UIImage *)photo completion:(void (^)(UIImage *cropImage,PHAsset *asset))completion;
  36. #pragma mark -
  37. /// Default is 9 / 默认最大可选9张图片
  38. @property (nonatomic, assign) NSInteger maxImagesCount;
  39. /// The minimum count photos user must pick, Default is 0
  40. /// 最小照片必选张数,默认是0
  41. @property (nonatomic, assign) NSInteger minImagesCount;
  42. /// Always enale the done button, not require minimum 1 photo be picked
  43. /// 让完成按钮一直可以点击,无须最少选择一张图片
  44. @property (nonatomic, assign) BOOL alwaysEnableDoneBtn;
  45. /// Sort photos ascending by modificationDate,Default is YES
  46. /// 对照片排序,按修改时间升序,默认是YES。如果设置为NO,最新的照片会显示在最前面,内部的拍照按钮会排在第一个
  47. @property (nonatomic, assign) BOOL sortAscendingByModificationDate;
  48. /// The pixel width of output image, Default is 828px / 导出图片的宽度,默认828像素宽
  49. @property (nonatomic, assign) CGFloat photoWidth;
  50. /// Default is 600px / 默认600像素宽
  51. @property (nonatomic, assign) CGFloat photoPreviewMaxWidth;
  52. /// Default is 15, While fetching photo, HUD will dismiss automatic if timeout;
  53. /// 超时时间,默认为15秒,当取图片时间超过15秒还没有取成功时,会自动dismiss HUD;
  54. @property (nonatomic, assign) NSInteger timeout;
  55. /// Default is YES, if set NO, the original photo button will hide. user can't picking original photo.
  56. /// 默认为YES,如果设置为NO,原图按钮将隐藏,用户不能选择发送原图
  57. @property (nonatomic, assign) BOOL allowPickingOriginalPhoto;
  58. /// Default is YES, if set NO, user can't picking video.
  59. /// 默认为YES,如果设置为NO,用户将不能选择视频
  60. @property (nonatomic, assign) BOOL allowPickingVideo;
  61. /// Default is NO / 默认为NO,为YES时可以多选视频/gif/图片,和照片共享最大可选张数maxImagesCount的限制
  62. @property (nonatomic, assign) BOOL allowPickingMultipleVideo;
  63. /// Default is NO, if set YES, user can picking gif image.
  64. /// 默认为NO,如果设置为YES,用户可以选择gif图片
  65. @property (nonatomic, assign) BOOL allowPickingGif;
  66. /// Default is YES, if set NO, user can't picking image.
  67. /// 默认为YES,如果设置为NO,用户将不能选择发送图片
  68. @property (nonatomic, assign) BOOL allowPickingImage;
  69. /// Default is YES, if set NO, user can't take picture.
  70. /// 默认为YES,如果设置为NO, 用户将不能拍摄照片
  71. @property (nonatomic, assign) BOOL allowTakePicture;
  72. @property (nonatomic, assign) BOOL allowCameraLocation;
  73. /// Default is YES, if set NO, user can't take video.
  74. /// 默认为YES,如果设置为NO, 用户将不能拍摄视频
  75. @property(nonatomic, assign) BOOL allowTakeVideo;
  76. /// Default value is 10 minutes / 视频最大拍摄时间,默认是10分钟,单位是秒
  77. @property (assign, nonatomic) NSTimeInterval videoMaximumDuration;
  78. /// Customizing UIImagePickerController's other properties, such as videoQuality / 定制UIImagePickerController的其它属性,比如视频拍摄质量videoQuality
  79. @property (nonatomic, copy) void(^uiImagePickerControllerSettingBlock)(UIImagePickerController *imagePickerController);
  80. /// 首选语言,如果设置了就用该语言,不设则取当前系统语言。
  81. /// 由于目前只支持中文、繁体中文、英文、越南语。故该属性只支持zh-Hans、zh-Hant、en、vi四种值,其余值无效。
  82. @property (copy, nonatomic) NSString *preferredLanguage;
  83. /// 语言bundle,preferredLanguage变化时languageBundle会变化
  84. /// 可通过手动设置bundle,让选择器支持新的的语言(需要在设置preferredLanguage后设置languageBundle)。欢迎提交PR把语言文件提交上来~
  85. @property (strong, nonatomic) NSBundle *languageBundle;
  86. /// Default is YES, if set NO, user can't preview photo.
  87. /// 默认为YES,如果设置为NO,预览按钮将隐藏,用户将不能去预览照片
  88. @property (nonatomic, assign) BOOL allowPreview;
  89. /// Default is YES, if set NO, the picker don't dismiss itself.
  90. /// 默认为YES,如果设置为NO, 选择器将不会自己dismiss
  91. @property(nonatomic, assign) BOOL autoDismiss;
  92. /// Default is NO, if set YES, in the delegate method the photos and infos will be nil, only assets hava value.
  93. /// 默认为NO,如果设置为YES,代理方法里photos和infos会是nil,只返回assets
  94. @property (assign, nonatomic) BOOL onlyReturnAsset;
  95. /// Default is NO, if set YES, will show the image's selected index.
  96. /// 默认为NO,如果设置为YES,会显示照片的选中序号
  97. @property (assign, nonatomic) BOOL showSelectedIndex;
  98. /// Default is NO, if set YES, when selected photos's count up to maxImagesCount, other photo will show float layer what's color is cannotSelectLayerColor.
  99. /// 默认是NO,如果设置为YES,当照片选择张数达到maxImagesCount时,其它照片会显示颜色为cannotSelectLayerColor的浮层
  100. @property (assign, nonatomic) BOOL showPhotoCannotSelectLayer;
  101. /// Default is white color with 0.8 alpha;
  102. @property (strong, nonatomic) UIColor *cannotSelectLayerColor;
  103. /// Default is YES, if set NO, the result photo will be scaled to photoWidth pixel width. The photoWidth default is 828px
  104. /// 默认是YES,如果设置为NO,内部会缩放图片到photoWidth像素宽
  105. @property (assign, nonatomic) BOOL notScaleImage;
  106. /// 默认是NO,如果设置为YES,导出视频时会修正转向(慎重设为YES,可能导致部分安卓下拍的视频导出失败)
  107. @property (assign, nonatomic) BOOL needFixComposition;
  108. /// The photos user have selected
  109. /// 用户选中过的图片数组
  110. @property (nonatomic, strong) NSMutableArray *selectedAssets;
  111. @property (nonatomic, strong) NSMutableArray<TZAssetModel *> *selectedModels;
  112. @property (nonatomic, strong) NSMutableArray *selectedAssetIds;
  113. - (void)addSelectedModel:(TZAssetModel *)model;
  114. - (void)removeSelectedModel:(TZAssetModel *)model;
  115. /// Minimum selectable photo width, Default is 0
  116. /// 最小可选中的图片宽度,默认是0,小于这个宽度的图片不可选中
  117. @property (nonatomic, assign) NSInteger minPhotoWidthSelectable;
  118. @property (nonatomic, assign) NSInteger minPhotoHeightSelectable;
  119. /// Hide the photo what can not be selected, Default is NO
  120. /// 隐藏不可以选中的图片,默认是NO,不推荐将其设置为YES
  121. @property (nonatomic, assign) BOOL hideWhenCanNotSelect;
  122. /// Deprecated, Use statusBarStyle (顶部statusBar 是否为系统默认的黑色,默认为NO)
  123. @property (nonatomic, assign) BOOL isStatusBarDefault __attribute__((deprecated("Use -statusBarStyle.")));
  124. /// statusBar的样式,默认为UIStatusBarStyleLightContent
  125. @property (assign, nonatomic) UIStatusBarStyle statusBarStyle;
  126. #pragma mark -
  127. /// Single selection mode, valid when maxImagesCount = 1
  128. /// 单选模式,maxImagesCount为1时才生效
  129. @property (nonatomic, assign) BOOL showSelectBtn; ///< 在单选模式下,照片列表页中,显示选择按钮,默认为NO
  130. @property (nonatomic, assign) BOOL allowCrop; ///< 允许裁剪,默认为YES,showSelectBtn为NO才生效
  131. @property (nonatomic, assign) BOOL scaleAspectFillCrop; ///< 是否图片等比缩放填充cropRect区域
  132. @property (nonatomic, assign) CGRect cropRect; ///< 裁剪框的尺寸
  133. @property (nonatomic, assign) CGRect cropRectPortrait; ///< 裁剪框的尺寸(竖屏)
  134. @property (nonatomic, assign) CGRect cropRectLandscape; ///< 裁剪框的尺寸(横屏)
  135. @property (nonatomic, assign) BOOL needCircleCrop; ///< 需要圆形裁剪框
  136. @property (nonatomic, assign) NSInteger circleCropRadius; ///< 圆形裁剪框半径大小
  137. @property (nonatomic, copy) void (^cropViewSettingBlock)(UIView *cropView); ///< 自定义裁剪框的其他属性
  138. @property (nonatomic, copy) void (^navLeftBarButtonSettingBlock)(UIButton *leftButton); ///< 自定义返回按钮样式及其属性
  139. /// 【自定义各页面/组件的样式】在界面初始化/组件setModel完成后调用,允许外界修改样式等
  140. @property (nonatomic, copy) void (^photoPickerPageUIConfigBlock)(UICollectionView *collectionView, UIView *bottomToolBar, UIButton *previewButton, UIButton *originalPhotoButton, UILabel *originalPhotoLabel, UIButton *doneButton, UIImageView *numberImageView, UILabel *numberLabel, UIView *divideLine);
  141. @property (nonatomic, copy) void (^photoPreviewPageUIConfigBlock)(UICollectionView *collectionView, UIView *naviBar, UIButton *backButton, UIButton *selectButton, UILabel *indexLabel, UIView *toolBar, UIButton *originalPhotoButton, UILabel *originalPhotoLabel, UIButton *doneButton, UIImageView *numberImageView, UILabel *numberLabel);
  142. @property (nonatomic, copy) void (^videoPreviewPageUIConfigBlock)(UIButton *playButton, UIView *toolBar, UIButton *doneButton);
  143. @property (nonatomic, copy) void (^gifPreviewPageUIConfigBlock)(UIView *toolBar, UIButton *doneButton);
  144. @property (nonatomic, copy) void (^assetCellDidSetModelBlock)(TZAssetCell *cell, UIImageView *imageView, UIImageView *selectImageView, UILabel *indexLabel, UIView *bottomView, UILabel *timeLength, UIImageView *videoImgView);
  145. @property (nonatomic, copy) void (^albumCellDidSetModelBlock)(TZAlbumCell *cell, UIImageView *posterImageView, UILabel *titleLabel);
  146. /// 【自定义各页面/组件的frame】在界面viewDidLayoutSubviews/组件layoutSubviews后调用,允许外界修改frame等
  147. @property (nonatomic, copy) void (^photoPickerPageDidLayoutSubviewsBlock)(UICollectionView *collectionView, UIView *bottomToolBar, UIButton *previewButton, UIButton *originalPhotoButton, UILabel *originalPhotoLabel, UIButton *doneButton, UIImageView *numberImageView, UILabel *numberLabel, UIView *divideLine);
  148. @property (nonatomic, copy) void (^photoPreviewPageDidLayoutSubviewsBlock)(UICollectionView *collectionView, UIView *naviBar, UIButton *backButton, UIButton *selectButton, UILabel *indexLabel, UIView *toolBar, UIButton *originalPhotoButton, UILabel *originalPhotoLabel, UIButton *doneButton, UIImageView *numberImageView, UILabel *numberLabel);
  149. @property (nonatomic, copy) void (^videoPreviewPageDidLayoutSubviewsBlock)(UIButton *playButton, UIView *toolBar, UIButton *doneButton);
  150. @property (nonatomic, copy) void (^gifPreviewPageDidLayoutSubviewsBlock)(UIView *toolBar, UIButton *doneButton);
  151. @property (nonatomic, copy) void (^assetCellDidLayoutSubviewsBlock)(TZAssetCell *cell, UIImageView *imageView, UIImageView *selectImageView, UILabel *indexLabel, UIView *bottomView, UILabel *timeLength, UIImageView *videoImgView);
  152. @property (nonatomic, copy) void (^albumCellDidLayoutSubviewsBlock)(TZAlbumCell *cell, UIImageView *posterImageView, UILabel *titleLabel);
  153. /// 自定义各页面/组件的frame】刷新底部状态(refreshNaviBarAndBottomBarState)使用的
  154. @property (nonatomic, copy) void (^photoPickerPageDidRefreshStateBlock)(UICollectionView *collectionView, UIView *bottomToolBar, UIButton *previewButton, UIButton *originalPhotoButton, UILabel *originalPhotoLabel, UIButton *doneButton, UIImageView *numberImageView, UILabel *numberLabel, UIView *divideLine);
  155. @property (nonatomic, copy) void (^photoPreviewPageDidRefreshStateBlock)(UICollectionView *collectionView, UIView *naviBar, UIButton *backButton, UIButton *selectButton, UILabel *indexLabel, UIView *toolBar, UIButton *originalPhotoButton, UILabel *originalPhotoLabel, UIButton *doneButton, UIImageView *numberImageView, UILabel *numberLabel);
  156. #pragma mark -
  157. - (UIAlertController *)showAlertWithTitle:(NSString *)title;
  158. - (void)hideAlertView:(UIAlertController *)alertView;
  159. - (void)showProgressHUD;
  160. - (void)hideProgressHUD;
  161. @property (nonatomic, assign) BOOL isSelectOriginalPhoto;
  162. @property (assign, nonatomic) BOOL needShowStatusBar;
  163. #pragma mark -
  164. @property (nonatomic, copy) NSString *takePictureImageName __attribute__((deprecated("Use -takePictureImage.")));
  165. @property (nonatomic, copy) NSString *photoSelImageName __attribute__((deprecated("Use -photoSelImage.")));
  166. @property (nonatomic, copy) NSString *photoDefImageName __attribute__((deprecated("Use -photoDefImage.")));
  167. @property (nonatomic, copy) NSString *photoOriginSelImageName __attribute__((deprecated("Use -photoOriginSelImage.")));
  168. @property (nonatomic, copy) NSString *photoOriginDefImageName __attribute__((deprecated("Use -photoOriginDefImage.")));
  169. @property (nonatomic, copy) NSString *photoPreviewOriginDefImageName __attribute__((deprecated("Use -photoPreviewOriginDefImage.")));
  170. @property (nonatomic, copy) NSString *photoNumberIconImageName __attribute__((deprecated("Use -photoNumberIconImage.")));
  171. @property (nonatomic, strong) UIImage *takePictureImage;
  172. @property (nonatomic, strong) UIImage *photoSelImage;
  173. @property (nonatomic, strong) UIImage *photoDefImage;
  174. @property (nonatomic, strong) UIImage *photoOriginSelImage;
  175. @property (nonatomic, strong) UIImage *photoOriginDefImage;
  176. @property (nonatomic, strong) UIImage *photoPreviewOriginDefImage;
  177. @property (nonatomic, strong) UIImage *photoNumberIconImage;
  178. #pragma mark -
  179. /// Appearance / 外观颜色 + 按钮文字
  180. @property (nonatomic, strong) UIColor *oKButtonTitleColorNormal;
  181. @property (nonatomic, strong) UIColor *oKButtonTitleColorDisabled;
  182. @property (nonatomic, strong) UIColor *naviBgColor;
  183. @property (nonatomic, strong) UIColor *naviTitleColor;
  184. @property (nonatomic, strong) UIFont *naviTitleFont;
  185. @property (nonatomic, strong) UIColor *barItemTextColor;
  186. @property (nonatomic, strong) UIFont *barItemTextFont;
  187. @property (nonatomic, copy) NSString *doneBtnTitleStr;
  188. @property (nonatomic, copy) NSString *cancelBtnTitleStr;
  189. @property (nonatomic, copy) NSString *previewBtnTitleStr;
  190. @property (nonatomic, copy) NSString *fullImageBtnTitleStr;
  191. @property (nonatomic, copy) NSString *settingBtnTitleStr;
  192. @property (nonatomic, copy) NSString *processHintStr;
  193. /// Icon theme color, default is green color like wechat, the value is r:31 g:185 b:34. Currently only support image selection icon when showSelectedIndex is YES. If you need it, please set it as soon as possible
  194. /// icon主题色,默认是微信的绿色,值是r:31 g:185 b:34。目前仅支持showSelectedIndex为YES时的图片选中icon。如需要,请尽早设置它。
  195. @property (strong, nonatomic) UIColor *iconThemeColor;
  196. #pragma mark -
  197. - (void)cancelButtonClick;
  198. // For method annotations, see the corresponding method in TZImagePickerControllerDelegate / 方法注释见TZImagePickerControllerDelegate中对应方法
  199. @property (nonatomic, copy) void (^didFinishPickingPhotosHandle)(NSArray<UIImage *> *photos,NSArray *assets,BOOL isSelectOriginalPhoto);
  200. @property (nonatomic, copy) void (^didFinishPickingPhotosWithInfosHandle)(NSArray<UIImage *> *photos,NSArray *assets,BOOL isSelectOriginalPhoto,NSArray<NSDictionary *> *infos);
  201. @property (nonatomic, copy) void (^imagePickerControllerDidCancelHandle)(void);
  202. @property (nonatomic, copy) void (^didFinishPickingVideoHandle)(UIImage *coverImage,PHAsset *asset);
  203. @property (nonatomic, copy) void (^didFinishPickingGifImageHandle)(UIImage *animatedImage,id sourceAssets);
  204. @property (nonatomic, weak) id<TZImagePickerControllerDelegate> pickerDelegate;
  205. @end
  206. @protocol TZImagePickerControllerDelegate <NSObject>
  207. @optional
  208. // The picker should dismiss itself; when it dismissed these callback will be called.
  209. // You can also set autoDismiss to NO, then the picker don't dismiss itself.
  210. // If isOriginalPhoto is YES, user picked the original photo.
  211. // You can get original photo with asset, by the method [[TZImageManager manager] getOriginalPhotoWithAsset:completion:].
  212. // The UIImage Object in photos default width is 828px, you can set it by photoWidth property.
  213. // 这个照片选择器会自己dismiss,当选择器dismiss的时候,会执行下面的代理方法
  214. // 你也可以设置autoDismiss属性为NO,选择器就不会自己dismis了
  215. // 如果isSelectOriginalPhoto为YES,表明用户选择了原图
  216. // 你可以通过一个asset获得原图,通过这个方法:[[TZImageManager manager] getOriginalPhotoWithAsset:completion:]
  217. // photos数组里的UIImage对象,默认是828像素宽,你可以通过设置photoWidth属性的值来改变它
  218. - (void)imagePickerController:(TZImagePickerController *)picker didFinishPickingPhotos:(NSArray<UIImage *> *)photos sourceAssets:(NSArray *)assets isSelectOriginalPhoto:(BOOL)isSelectOriginalPhoto;
  219. - (void)imagePickerController:(TZImagePickerController *)picker didFinishPickingPhotos:(NSArray<UIImage *> *)photos sourceAssets:(NSArray *)assets isSelectOriginalPhoto:(BOOL)isSelectOriginalPhoto infos:(NSArray<NSDictionary *> *)infos;
  220. - (void)tz_imagePickerControllerDidCancel:(TZImagePickerController *)picker;
  221. // If user picking a video and allowPickingMultipleVideo is NO, this callback will be called.
  222. // If allowPickingMultipleVideo is YES, will call imagePickerController:didFinishPickingPhotos:sourceAssets:isSelectOriginalPhoto:
  223. // 如果用户选择了一个视频且allowPickingMultipleVideo是NO,下面的代理方法会被执行
  224. // 如果allowPickingMultipleVideo是YES,将会调用imagePickerController:didFinishPickingPhotos:sourceAssets:isSelectOriginalPhoto:
  225. - (void)imagePickerController:(TZImagePickerController *)picker didFinishPickingVideo:(UIImage *)coverImage sourceAssets:(PHAsset *)asset;
  226. // If user picking a gif image and allowPickingMultipleVideo is NO, this callback will be called.
  227. // If allowPickingMultipleVideo is YES, will call imagePickerController:didFinishPickingPhotos:sourceAssets:isSelectOriginalPhoto:
  228. // 如果用户选择了一个gif图片且allowPickingMultipleVideo是NO,下面的代理方法会被执行
  229. // 如果allowPickingMultipleVideo是YES,将会调用imagePickerController:didFinishPickingPhotos:sourceAssets:isSelectOriginalPhoto:
  230. - (void)imagePickerController:(TZImagePickerController *)picker didFinishPickingGifImage:(UIImage *)animatedImage sourceAssets:(PHAsset *)asset;
  231. // Decide album show or not't
  232. // 决定相册显示与否 albumName:相册名字 result:相册原始数据
  233. - (BOOL)isAlbumCanSelect:(NSString *)albumName result:(PHFetchResult *)result;
  234. // Decide asset show or not't
  235. // 决定照片显示与否
  236. - (BOOL)isAssetCanSelect:(PHAsset *)asset;
  237. @end
  238. @interface TZAlbumPickerController : UIViewController
  239. @property (nonatomic, assign) NSInteger columnNumber;
  240. @property (assign, nonatomic) BOOL isFirstAppear;
  241. - (void)configTableView;
  242. @end
  243. @interface UIImage (MyBundle)
  244. + (UIImage *)tz_imageNamedFromMyBundle:(NSString *)name;
  245. @end
  246. @interface TZCommonTools : NSObject
  247. + (BOOL)tz_isIPhoneX;
  248. + (CGFloat)tz_statusBarHeight;
  249. // 获得Info.plist数据字典
  250. + (NSDictionary *)tz_getInfoDictionary;
  251. + (BOOL)tz_isRightToLeftLayout;
  252. @end
  253. @interface TZImagePickerConfig : NSObject
  254. + (instancetype)sharedInstance;
  255. @property (copy, nonatomic) NSString *preferredLanguage;
  256. @property(nonatomic, assign) BOOL allowPickingImage;
  257. @property (nonatomic, assign) BOOL allowPickingVideo;
  258. @property (strong, nonatomic) NSBundle *languageBundle;
  259. @property (assign, nonatomic) BOOL showSelectedIndex;
  260. @property (assign, nonatomic) BOOL showPhotoCannotSelectLayer;
  261. @property (assign, nonatomic) BOOL notScaleImage;
  262. @property (assign, nonatomic) BOOL needFixComposition;
  263. /// 默认是50,如果一个GIF过大,里面图片个数可能超过1000,会导致内存飙升而崩溃
  264. @property (assign, nonatomic) NSInteger gifPreviewMaxImagesCount;
  265. /// 【自定义GIF播放方案】为了避免内存过大,内部默认限制只播放50帧(平均取),可通过gifPreviewMaxImagesCount属性调整,若对GIF预览有更好的效果要求,可实现这个block采用FLAnimatedImage等三方库来播放,但注意FLAnimatedImage有播放速度较慢问题,自行取舍下。
  266. @property (nonatomic, copy) void (^gifImagePlayBlock)(TZPhotoPreviewView *view, UIImageView *imageView, NSData *gifData, NSDictionary *info);
  267. @end