MBProgressHUD+NHAdd.h 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. //
  2. // MBProgressHUD+NHAdd.h
  3. // NHHUDExtendDemo
  4. //
  5. // Created by 肖雨 on 2017/8/18.
  6. // Copyright © 2017年 肖雨. All rights reserved.
  7. //
  8. #import "MBProgressHUD_NHExtend.h"
  9. @class MBProgressHUD;
  10. //默认持续显示时间(x秒后消失)
  11. UIKIT_EXTERN CGFloat const delayTime;
  12. /** 设置默认的显示风格(修改这个值可以减少频繁的调用setHudStyle):
  13. * NHHUDContentDefaultStyle = 0,//默认是白底黑字 Default
  14. * NHHUDContentBlackStyle = 1,//黑底白字
  15. * NHHUDContentCustomStyle = 2,
  16. *
  17. * eg:设置为1时,调用任何这个扩展内的方法,显示出hud的UI效果都会为黑底白字风格
  18. */
  19. #define NHDefaultHudStyle 1
  20. /**
  21. * 风格为自定义时,在这里设置颜色
  22. */
  23. #define NHCustomHudStyleBackgrandColor [UIColor colorWithWhite:0.f alpha:0.7f]
  24. #define NHCustomHudStyleContentColor [UIColor colorWithWhite:1.f alpha:0.7f]
  25. @interface MBProgressHUD (NHAdd)
  26. //*************************************************************************************//
  27. // 所有类方法中有返回本类的,则不会自动消失,返回值为void的都会自动消失(默认值:delayTime) //
  28. // 所有类方法中有返回本类的,则不会自动消失,返回值为void的都会自动消失(默认值:delayTime) //
  29. // 所有类方法中有返回本类的,则不会自动消失,返回值为void的都会自动消失(默认值:delayTime) //
  30. //*************************************************************************************//
  31. /**
  32. 纯加载图
  33. */
  34. + (MBProgressHUD *)showOnlyLoadToView:(UIView *)view;
  35. /**
  36. 纯文字
  37. */
  38. + (void)showOnlyTextToView:(UIView *)view title:(NSString *)title;
  39. /**
  40. 纯文字标题 + 详情
  41. */
  42. + (void)showOnlyTextToView:(UIView *)view title:(NSString *)title detail:(NSString *)detail;
  43. /**
  44. * 成功提示 - 自动消失,带默认成功图
  45. *
  46. * @param success 要显示的文字
  47. */
  48. + (void)showSuccess:(NSString *)success toView:(UIView *)view;
  49. /**
  50. * 错误提示 - 自动消失, 带默认错误图
  51. *
  52. * @param error 要显示的错误文字
  53. */
  54. + (void)showError:(NSString *)error toView:(UIView *)view;
  55. /**
  56. 纯文字标题 + 自定位置 - 自动消失
  57. @param postion 位置:上、中、下
  58. */
  59. + (void)showTitleToView:(UIView *)view
  60. postion:(NHHUDPostion)postion
  61. title:(NSString *)title;
  62. /**
  63. 纯文字标题 + 详情 + 自定位置 - 自动消失
  64. @param postion 配置hud其它属性
  65. */
  66. + (void)showDetailToView:(UIView *)view
  67. postion:(NHHUDPostion)postion
  68. title:(NSString *)title
  69. detail:(NSString *)detail;
  70. /**
  71. 纯文字 + 自定位置、风格 - 自动消失
  72. @param postion 位置
  73. @param contentStyle 风格
  74. */
  75. + (void)showTitleToView:(UIView *)view
  76. postion:(NHHUDPostion)postion
  77. contentStyle:(NHHUDContentStyle)contentStyle
  78. title:(NSString *)title;
  79. /**
  80. 文字 + 加载图
  81. */
  82. + (MBProgressHUD *)showLoadToView:(UIView *)view title:(NSString *)title;
  83. /**
  84. 文字 + 加载图 + 自定风格
  85. */
  86. + (MBProgressHUD *)showLoadToView:(UIView *)view contentStyle:(NHHUDContentStyle)contentStyle title:(NSString *)title;
  87. /**
  88. 纯文字 + 自定位置 x秒后自动消失
  89. @param delay 延迟消失时间
  90. */
  91. + (void)showTitleToView:(UIView *)view
  92. contentStyle:(NHHUDContentStyle)contentStyle
  93. title:(NSString *)title
  94. afterDelay:(NSTimeInterval)delay;
  95. /**
  96. 文字 + 进度条
  97. @param progressStyle 进度条风格
  98. @param progress 当前进度值
  99. */
  100. + (MBProgressHUD *)showDownToView:(UIView *)view
  101. progressStyle:(NHHUDProgressStyle)progressStyle
  102. title:(NSString *)title
  103. progress:(NHCurrentHud)progress;
  104. /**
  105. 文字 + 进度条 + 取消按钮
  106. @param progressStyle 进度条风格
  107. @param progress 当前进度值
  108. @param cancelTitle 取消按钮名称
  109. @param cancelation 取消按钮的点击事件
  110. */
  111. + (MBProgressHUD *)showDownToView:(UIView *)view
  112. progressStyle:(NHHUDProgressStyle)progressStyle
  113. title:(NSString *)title
  114. cancelTitle:(NSString *)cancelTitle
  115. progress:(NHCurrentHud)progress
  116. cancelation:(NHCancelation)cancelation;
  117. /**
  118. 文字 + 自定图片
  119. @param image 图片
  120. */
  121. + (void)showCustomView:(UIImage *)image
  122. toView:(UIView *)toView
  123. title:(NSString *)title;
  124. /**
  125. 文字 + 默认加载图 + 自定朦胧层背景色
  126. @param backgroundColor 自定背景色
  127. */
  128. + (MBProgressHUD *)showLoadToView:(UIView *)view
  129. backgroundColor:(UIColor *)backgroundColor
  130. title:(NSString *)title;
  131. /**
  132. 文字 + 默认加载图 + 自定文字、加载图颜色
  133. @param contentColor 自定文字、加载图颜色
  134. */
  135. + (MBProgressHUD *)showLoadToView:(UIView *)view
  136. contentColor:(UIColor *)contentColor
  137. title:(NSString *)title;
  138. /**
  139. 文字 + 默认加载图 + 自定文图内容颜色 + 自定朦胧层背景色
  140. @param contentColor 自定文字、加载图颜色
  141. @param backgroundColor + 自定朦胧层背景色
  142. */
  143. + (MBProgressHUD *)showLoadToView:(UIView *)view
  144. contentColor:(UIColor *)contentColor
  145. backgroundColor:(UIColor *)backgroundColor
  146. title:(NSString *)title;
  147. /**
  148. 文字 + 默认加载图 + 自定文字及加载图颜色 + 自定朦胧层背景色
  149. @param titleColor 自定文字
  150. @param bezelViewColor 加载图背景颜色
  151. @param backgroundColor + 自定朦胧层背景色
  152. */
  153. + (MBProgressHUD *)showLoadToView:(UIView *)view
  154. titleColor:(UIColor *)titleColor
  155. bezelViewColor:(UIColor *)bezelViewColor
  156. backgroundColor:(UIColor *)backgroundColor
  157. title:(NSString *)title;
  158. /**
  159. 状态变换
  160. @param configHud 配置hud其它属性
  161. */
  162. + (MBProgressHUD *)showModelSwitchToView:(UIView *)toView
  163. title:(NSString *)title
  164. configHud:(NHCurrentHud)configHud;
  165. /**
  166. 文字 + 进度 网络请求
  167. @param configHud 配置hud其它属性
  168. */
  169. + (MBProgressHUD *)showDownWithNSProgress:(NSProgress *)Progress
  170. toView:(UIView *)view
  171. title:(NSString *)title
  172. configHud:(NHCurrentHud)configHud;
  173. /**
  174. 隐藏ProgressView
  175. */
  176. + (void)hideHUDForView:(UIView *)view;
  177. /**
  178. 隐藏(从window)
  179. */
  180. + (void)hideHUD;
  181. /**
  182. 创建一个新的hud
  183. @param configHud 配置hud其它属性
  184. */
  185. + (MBProgressHUD *)createHudToView:(UIView *)view
  186. title:(NSString *)title
  187. configHud:(NHCurrentHud)configHud;
  188. @end