WMZPageConfig.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. //
  2. // WMZPageConfig.h
  3. // WMZPageController
  4. //
  5. // Created by wmz on 2019/9/17.
  6. // Copyright © 2019 wmz. All rights reserved.
  7. //
  8. #ifndef WMZPageConfig_h
  9. #define WMZPageConfig_h
  10. #import <UIKit/UIKit.h>
  11. #import <objc/runtime.h>
  12. #import "WMZPageProtocol.h"
  13. #import "NSObject+SafeKVO.h"
  14. #import "UIView+PageRect.h"
  15. #define PageVCWidth [UIScreen mainScreen].bounds.size.width
  16. #define PageVCHeight [UIScreen mainScreen].bounds.size.height
  17. #define myHeight 100
  18. #define PageDarkColor(light,dark) \
  19. ({\
  20. UIColor *wMenuIndicator = nil; \
  21. if (@available(iOS 13.0, *)) { \
  22. wMenuIndicator = [UIColor colorWithDynamicProvider:^UIColor * _Nonnull(UITraitCollection * _Nonnull traitCollection) { \
  23. if ([traitCollection userInterfaceStyle] == UIUserInterfaceStyleLight) { \
  24. return light; \
  25. }else { \
  26. return dark; \
  27. }}]; \
  28. }else{ \
  29. wMenuIndicator = light; \
  30. } \
  31. (wMenuIndicator); \
  32. })\
  33. #define PageColor(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
  34. #define PageK1px (1 / UIScreen.mainScreen.scale)
  35. #define PageVCIS_iPhoneX (CGSizeEqualToSize(CGSizeMake(375.f, 812.f), [UIScreen mainScreen].bounds.size) || CGSizeEqualToSize(CGSizeMake(812.f, 375.f), [UIScreen mainScreen].bounds.size) || CGSizeEqualToSize(CGSizeMake(414.f, 896.f), [UIScreen mainScreen].bounds.size) || CGSizeEqualToSize(CGSizeMake(896.f, 414.f), [UIScreen mainScreen].bounds.size))
  36. //状态栏高度
  37. #define PageVCStatusBarHeight (PageVCIS_iPhoneX ? 44.f : 20.f)
  38. //导航栏高度
  39. #define PageVCNavBarHeight (44.f+PageVCStatusBarHeight)
  40. //底部标签栏高度
  41. #define PageVCTabBarHeight (PageVCIS_iPhoneX ? (49.f+34.f) : 49.f)
  42. #define PageWindow [UIApplication sharedApplication].keyWindow
  43. #define pageIsIphoneX ({\
  44. BOOL isPhoneX = NO;\
  45. if (@available(iOS 11.0, *)) {\
  46. if ([[[UIApplication sharedApplication] delegate] window].safeAreaInsets.bottom > 0.0) {\
  47. isPhoneX = YES;\
  48. }\
  49. }\
  50. isPhoneX;\
  51. })
  52. #define WMZPagePropStatementAndPropSetFuncStatement(propertyModifier,className, propertyPointerType, propertyName) \
  53. @property(nonatomic,propertyModifier)propertyPointerType propertyName; \
  54. - (className * (^) (propertyPointerType propertyName)) propertyName##Set;
  55. #define WMZPagePropSetFuncImplementation(className, propertyPointerType, propertyName) \
  56. - (className * (^) (propertyPointerType propertyName))propertyName##Set{ \
  57. return ^(propertyPointerType propertyName) { \
  58. _##propertyName = propertyName; \
  59. return self; \
  60. }; \
  61. }
  62. typedef enum :NSInteger{
  63. PageBtnPositionLeft = 0, //图片在左,文字在右,默认
  64. PageBtnPositionRight = 1, //图片在右,文字在左
  65. PageBtnPositionTop = 2, //图片在上,文字在下
  66. PageBtnPositionBottom = 3, //图片在下,文字在上
  67. }PageBtnPosition;
  68. typedef enum :NSInteger{
  69. PageTitleMenuNone = 0, //无样式
  70. PageTitleMenuLine = 1, //带下划线
  71. PageTitleMenuCircle = 2, //背景圆角框
  72. PageTitleMenuAiQY = 3, //爱奇艺效果(指示器跟随移动)
  73. PageTitleMenuTouTiao = 4, //今日头条效果(变大加颜色渐变)
  74. PageTitleMenuYouKu = 5, //优酷效果(变大字体加粗 指示器圆点 指示器跟随移动)
  75. PageTitleMenuPDD = 6, //拼多多效果(底部线条)
  76. }PageTitleMenu;
  77. typedef enum :NSInteger{
  78. PageMenuPositionLeft = 0, //上左
  79. PageMenuPositionRight = 1, //上右
  80. PageMenuPositionCenter = 2, //居中
  81. PageMenuPositionNavi = 3, //导航栏
  82. PageMenuPositionBottom = 4, //底部
  83. }PageMenuPosition;
  84. //设置阴影
  85. typedef enum :NSInteger{
  86. PageShadowPathTop,
  87. PageShadowPathBottom,
  88. PageShadowPathLeft,
  89. PageShadowPathRight,
  90. PageShadowPathCommon,
  91. PageShadowPathAround
  92. }PageShadowPathType;
  93. //渐变色
  94. typedef enum :NSInteger{
  95. PageGradientChangeDirectionLevel, //水平方向渐变
  96. PageGradientChangeDirectionVertical, //垂直方向渐变
  97. PageGradientChangeDirectionUpwardDiagonalLine, //主对角线方向渐变
  98. PageGradientChangeDirectionDownDiagonalLine, //副对角线方向渐变
  99. }PageGradientChangeDirection;
  100. /*
  101. * 点击
  102. */
  103. typedef void (^PageClickBlock)(id anyID,NSInteger index);
  104. /*
  105. * 控制器切换
  106. */
  107. typedef void (^PageVCChangeBlock)(UIViewController* oldVC,UIViewController *newVC,NSInteger oldIndex,NSInteger newIndex);
  108. /*
  109. * 子控制器滚动
  110. */
  111. typedef void (^PageChildVCScroll)(UIViewController* pageVC,CGPoint oldPoint,CGPoint newPonit,UIScrollView *currentScrollView);
  112. /*
  113. * 头视图
  114. */
  115. typedef UIView* (^PageHeadViewBlock)(void);
  116. /*
  117. * 固定尾视图
  118. */
  119. typedef UIView* (^PageFootViewBlock)(void);
  120. /*
  121. * 头视图和菜单栏的背景层
  122. */
  123. typedef void (^PageHeadAndMenuBgView)(UIView *bgView);
  124. /*
  125. * 自定义菜单栏
  126. */
  127. typedef void (^PageCustomMenuTitle)(NSArray *titleArr);
  128. /*
  129. * 滚动 后改变标题
  130. */
  131. typedef void (^PageCustomMenuSelectTitle)(NSArray *titleArr);
  132. #endif /* WMZPageConfig_h */