BGCommonMacro.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. //
  2. // BGCommonMacro.h
  3. // BuguLive
  4. //
  5. // Created by xfg on 16/8/3.
  6. // Copyright © 2016年 xfg. All rights reserved.
  7. // 综合宏
  8. #ifndef FWCommonMacro_h
  9. #define FWCommonMacro_h
  10. #import "GlobalVariables.h"
  11. // 以下为大众宏(可能整个app都有用到)
  12. // weakself strongself
  13. #define FWWeakify(o) __weak typeof(self) fwwo = o;
  14. #define FWStrongify(o) __strong typeof(self) o = fwwo;
  15. #define kDefaultMargin DefaultMargin() // 边距
  16. static __inline__ CGFloat DefaultMargin()
  17. {
  18. if (([UIScreen mainScreen].bounds.size.width >= 375.0f))
  19. {
  20. return 8;
  21. }
  22. else
  23. {
  24. return 7;
  25. }
  26. }
  27. #define kAppMargin2 10 // 边距
  28. #define kBorderWidth 1 // 边框宽度
  29. #define kCornerRadius 4 // 圆角大小
  30. #define myLineHight1 1 // 分割线高度
  31. #define myLineHight2 2 // 个人中心横分割线2
  32. #define myLineHight3 3 // 个人中心竖直分割线
  33. #define myDotelineHight 1 // 虚线分割线高度
  34. #define pluginMargin 10 // 插件中心边距宽度
  35. #define pluginTitleHeight 44 // 插件中心标题高度
  36. #define pluginLineHeight 0.5 // 插件中心线的高度
  37. #define betButtonWidth 30 // 押注按钮的宽度
  38. #define betButtonInterval 5 // 押注按钮之间的间隔
  39. #define kTicketContrainerViewHeight 22 // 印票父视图的高度
  40. #define kRechargeMargin (kScreenW-300)/2
  41. #define kDefaultPreloadHeadImg [UIImage imageNamed:@"com_preload_head_img"]
  42. //神秘人头像
  43. #define kDefaultNobleMysteriousHeadImg [UIImage imageNamed:@"live_noble_HeadImg"]
  44. //@"com_preload_head_img"] // 预加载头像
  45. #define kDefaultPreloadImgSquare [UIImage imageNamed:@"com_preload_img_square"] // 预加载图片(正方形)
  46. #define kDefaultPreloadImgRectangle [UIImage imageNamed:@"com_preload_img_rectangle"] // 预加载图片(长方形)
  47. #define kDefaultPreloadVideoHeadImg [UIImage imageNamed:@"preload_sVideo_head_img"] // 小视频详情预加载头像
  48. #define kDefaultCoverColor RGB(238, 238, 238) // 预加载颜色
  49. // 检测当前版本是否审核版本
  50. CG_INLINE BOOL kIsCheckingVersion(void) {
  51. if ([VersionNum isEqualToString:[GlobalVariables sharedInstance].appModel.ios_checkVersionStr]) {
  52. return YES;
  53. }
  54. return NO;
  55. }
  56. //被踢下线发送的通知
  57. #define KLOGIN_OUT_Notification @"KLOGIN_OUT_Notification"
  58. // 当前屏幕方向
  59. typedef NS_ENUM(NSUInteger, kDirectionType)
  60. {
  61. kDirectionTypeDefault = 0, // home在下
  62. kDirectionTypeLeft = 1, // home在左
  63. kDirectionTypeRight = 2, // home在右
  64. kDirectionTypeTop = 3, // home在上
  65. };
  66. //=======================================================================================================================
  67. // 以下为小众宏(可能单纯某个类用到)
  68. #define kSegmentedHeight 44 // 首页Segmented高度
  69. #define kAdvsTimeInterval 4 // 广告位间隔轮播时间
  70. #define kRefreshWithNewaTimeInterval 20 // 主页热门定时刷新的时间
  71. #define kAdvsPageWidth 4 // 广告轮播组件的那个引导点的宽度
  72. #define kIsTCShowSupportIMCustom 1 // 是否支持IM自定义
  73. #define kHostNetLowTip1 ASLocalizedString(@"亲,您的网络有点小卡哦!")// 主播网络卡顿提示1
  74. #define kHostNetLowTip2 ASLocalizedString(@"亲,您的网络开小差啦!")// 主播网络卡顿提示2
  75. static const NSTimeInterval kMoveAnimationDuration = 0.4; //金币移动时间
  76. static const NSTimeInterval kNarrowAnimationDuration = 0.3; //金币缩小时间
  77. static const NSTimeInterval kCoinMoveAnimationDuration = kMoveAnimationDuration + kNarrowAnimationDuration; //金币动画总的时间
  78. #define kMyBtnWidth1 MyBtnWidth1() // 按钮宽度
  79. static __inline__ CGFloat MyBtnWidth1()
  80. {
  81. if (([UIScreen mainScreen].bounds.size.width >= 375.0f))
  82. {
  83. return 35;
  84. }
  85. else
  86. {
  87. return 30;
  88. }
  89. }
  90. #define kRechargeViewHeight RechargeViewHeight () // 充值界面的高度
  91. static __inline__ CGFloat RechargeViewHeight()
  92. {
  93. if (([UIScreen mainScreen].bounds.size.width >= 375.0f))
  94. {
  95. return 436;
  96. }
  97. else
  98. {
  99. return kScreenH-180;
  100. }
  101. }
  102. #define kNumberBoardHeight NumberBoardHeight () // 数字键盘高度
  103. static __inline__ CGFloat NumberBoardHeight()
  104. {
  105. if (kScreenW > 375.0f)
  106. {
  107. return 228;
  108. }
  109. else
  110. {
  111. return 218;
  112. }
  113. }
  114. // 插件中心高度
  115. #define kPluginCenterHeight PluginCenterHeight()
  116. static __inline__ CGFloat PluginCenterHeight()
  117. {
  118. return 380;
  119. if (([UIScreen mainScreen].bounds.size.height==568.0f))
  120. {
  121. return kScreenH * 0.68;
  122. }
  123. else if ([UIScreen mainScreen].bounds.size.height==667.0f)
  124. {
  125. return kScreenH * 0.62;
  126. }
  127. else if ([UIScreen mainScreen].bounds.size.height==736.0f)
  128. {
  129. return kScreenH * 0.6;
  130. }
  131. else
  132. {
  133. return kScreenH * 0.72;
  134. }
  135. }
  136. // 插件中心Y起始位置
  137. #define kPluginCenterY kScreenH-kPluginCenterHeight-kDefaultMargin
  138. // 个人中心设置按钮高度
  139. #define kCenterBtnHeight CenterBtnHeight()
  140. static __inline__ CGFloat CenterBtnHeight()
  141. {
  142. if (([UIScreen mainScreen].bounds.size.height==568.0f))
  143. {
  144. return kScreenH * 0.088;
  145. }
  146. else if ([UIScreen mainScreen].bounds.size.height==667.0f)
  147. {
  148. return kScreenH * 0.0803;
  149. }
  150. else if ([UIScreen mainScreen].bounds.size.height==736.0f)
  151. {
  152. return kScreenH * 0.0801;
  153. }
  154. else
  155. {
  156. return kScreenH * 0.088;
  157. }
  158. }
  159. // row 的高度随着手机屏幕高度的比例
  160. #define kAppRowHScale AppRowHScale()
  161. static __inline__ CGFloat AppRowHScale()
  162. {
  163. if (([UIScreen mainScreen].bounds.size.height==568.0f))
  164. {
  165. return 0.88f;
  166. }
  167. else if ([UIScreen mainScreen].bounds.size.height==667.0f)
  168. {
  169. return 1.00f;
  170. }
  171. else
  172. {
  173. return 1.12f;
  174. }
  175. }
  176. #endif /* FWCommonMacro_h */