GKPhotoBrowserConfigure.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. //
  2. // GKPhotoBrowserConfigure.h
  3. // GKPhotoBrowser
  4. //
  5. // Created by QuintGao on 2020/10/19.
  6. // Copyright © 2020年 QuintGao. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. #import "UIScrollView+GKPhotoBrowser.h"
  10. // 判断iPhone X
  11. #define KIsiPhoneX [GKPhotoBrowserConfigure gk_isNotchedScreen]
  12. // 底部安全区域高度
  13. #define kSafeTopSpace [GKPhotoBrowserConfigure gk_safeAreaTop]
  14. #define kSafeBottomSpace [GKPhotoBrowserConfigure gk_safeAreaBottom]
  15. // 默认最大缩放程度
  16. #define kMaxZoomScale 2.0f
  17. // 默认图片间距
  18. #define kPhotoViewPadding 10
  19. // 默认动画时间
  20. #define kAnimationDuration 0.3f
  21. // 加载本地图片
  22. #define GKPhotoBrowserImage(name) [GKPhotoBrowserConfigure gk_imageWithName:name]
  23. // 图片浏览器的显示方式
  24. typedef NS_ENUM(NSUInteger, GKPhotoBrowserShowStyle) {
  25. GKPhotoBrowserShowStyleNone, // 直接显示,默认方式
  26. GKPhotoBrowserShowStyleZoom, // 缩放显示,动画效果
  27. GKPhotoBrowserShowStylePush // push方式展示
  28. };
  29. // 图片浏览器的隐藏方式
  30. typedef NS_ENUM(NSUInteger, GKPhotoBrowserHideStyle) {
  31. GKPhotoBrowserHideStyleNone, // 无动画
  32. GKPhotoBrowserHideStyleZoom, // 点击缩放消失
  33. GKPhotoBrowserHideStyleZoomScale, // 点击缩放消失、滑动缩小后消失
  34. GKPhotoBrowserHideStyleZoomSlide // 点击缩放消失、滑动平移后消失
  35. };
  36. // 图片浏览器的加载方式
  37. typedef NS_ENUM(NSUInteger, GKPhotoBrowserLoadStyle) {
  38. GKPhotoBrowserLoadStyleIndeterminate, // 不明确的加载方式
  39. GKPhotoBrowserLoadStyleIndeterminateMask, // 不明确的加载方式带阴影
  40. GKPhotoBrowserLoadStyleDeterminate, // 明确的加载方式带进度条
  41. GKPhotoBrowserLoadStyleDeterminateSector, // 明确的加载方式扇形进度
  42. GKPhotoBrowserLoadStyleCustom // 自定义加载方式
  43. };
  44. // 图片加载失败的显示方式
  45. typedef NS_ENUM(NSUInteger, GKPhotoBrowserFailStyle) {
  46. GKPhotoBrowserFailStyleOnlyText, // 显示文字
  47. GKPhotoBrowserFailStyleOnlyImage, // 显示图片
  48. GKPhotoBrowserFailStyleImageAndText, // 显示图片+文字
  49. GKPhotoBrowserFailStyleCustom // 自定义(如:显示HUD)
  50. };
  51. @interface GKPhotoBrowserConfigure : NSObject
  52. /// 安全区域
  53. + (UIEdgeInsets)gk_safeAreaInsets;
  54. + (CGFloat)gk_safeAreaTop;
  55. + (CGFloat)gk_safeAreaBottom;
  56. /// 状态栏frame
  57. + (CGRect)gk_statusBarFrame;
  58. /// 是否是Mac
  59. + (BOOL)isMac;
  60. /// 判断是否是刘海屏
  61. + (BOOL)gk_isNotchedScreen;
  62. /// 获取当前 window
  63. + (UIWindow *)getKeyWindow;
  64. /// 根据图片名字获取图片
  65. /// @param name 图片名字
  66. + (UIImage *)gk_imageWithName:(NSString *)name;
  67. @end