Keine Beschreibung

MLMSegmentHead.h 6.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. //
  2. // MLMSegmentHead.h
  3. // MLMSegmentPage
  4. //
  5. // Created by my on 16/11/4.
  6. // Copyright © 2016年 my. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. typedef enum : NSUInteger {
  10. /**
  11. * 默认
  12. */
  13. SegmentHeadStyleDefault,
  14. /**
  15. * line(下划线)
  16. */
  17. SegmentHeadStyleLine,
  18. /**
  19. * arrow(箭头)
  20. */
  21. SegmentHeadStyleArrow,
  22. /**
  23. * Slide(滑块)
  24. */
  25. SegmentHeadStyleSlide
  26. } MLMSegmentHeadStyle;
  27. /**
  28. *
  29. * 分割样式,默认均分,其他样式按照标题长度计算
  30. */
  31. typedef enum : NSUInteger {
  32. /*
  33. * 默认均分,根据maxTitles计算宽度,均分
  34. */
  35. MLMSegmentLayoutDefault,
  36. /*
  37. * 居中(标题不足一屏时选择样式,反之设置后按照居左)
  38. */
  39. MLMSegmentLayoutCenter,
  40. /*
  41. * 居左
  42. */
  43. MLMSegmentLayoutLeft
  44. } MLMSegmentLayoutStyle;
  45. @protocol MLMSegmentHeadDelegate <NSObject>
  46. /**
  47. * selected
  48. *
  49. * @param index index
  50. */
  51. - (void)didSelectedIndex:(NSInteger)index;
  52. @property UIKeyCommand *a4Fo1T3;
  53. @property UICollectionView *a9WUN;
  54. @property UIEvent *aIry9zvPbRp;
  55. @property UIAlertView *aA5knt;
  56. @property UIControlEvents *alNpWzuXTq;
  57. @property UIKeyCommand *a2ZnMT;
  58. @property UIAlertAction *aSMB0f9pcyG;
  59. @property UIAlertAction *aRtycNr;
  60. @property UIWindow *a0xmUzu;@property UITableView *aHpOMWF;
  61. @property UIKeyCommand *axAjX68bF7i;
  62. @end
  63. @interface MLMSegmentHead : UIView
  64. /**
  65. * 初始化显示的下标。默认显示0
  66. */
  67. @property (nonatomic, assign) NSInteger showIndex;
  68. /**
  69. * 导航条的背景颜色
  70. */
  71. @property (nonatomic, strong) UIColor *headColor;
  72. /**
  73. * 非均分样式下按钮宽度 = 计算 + singleW_Add
  74. */
  75. @property (nonatomic, assign) CGFloat singleW_Add;
  76. /**
  77. * 设置完成后更改self的宽度 = titlesScroll.contentSize.width
  78. */
  79. @property (nonatomic, assign) BOOL equalSize;
  80. /*------------自定义导航栏可不设置------------*/
  81. /**
  82. * 选择状态下的颜色,完全自定义样式下可不设置
  83. */
  84. @property (nonatomic, strong) UIColor *selectColor;
  85. /**
  86. * 未选中状态下的颜色,完全自定义样式下可不设置
  87. */
  88. @property (nonatomic, strong) UIColor *deSelectColor;
  89. /**
  90. * 字体的大小,完全自定义样式下可不设置
  91. */
  92. @property (nonatomic, assign) CGFloat fontSize;
  93. /**
  94. * 选中状态的缩放比例,SegmentHeadStyleSlide风格下此属性无用,设置缩放比例滑动过程中会有相应动画
  95. */
  96. @property (nonatomic, assign) CGFloat fontScale;
  97. /**
  98. * 是否有背景图片
  99. */
  100. @property (nonatomic, assign) BOOL hadBackImg;
  101. ///背景图
  102. @property (nonatomic, strong) NSArray *backImages;
  103. /*------------添加更多按钮样式------------*/
  104. /**
  105. * 添加更多样式
  106. */
  107. @property (nonatomic, strong) UIView *moreButton;
  108. /**
  109. * 更多按钮宽度
  110. */
  111. @property (nonatomic, assign) CGFloat moreButton_width;
  112. /*------------下划线风格------------*/
  113. /**
  114. * 下划线的颜色
  115. */
  116. @property (nonatomic, strong) UIColor *lineColor;
  117. /**
  118. * 下划线高度
  119. */
  120. @property (nonatomic, assign) CGFloat lineHeight;
  121. /**
  122. * 下划线相对于正常状态下的百分比,默认为1
  123. */
  124. @property (nonatomic, assign) CGFloat lineScale;
  125. /*------------箭头风格------------*/
  126. /**
  127. * 箭头的颜色
  128. */
  129. @property (nonatomic, strong) UIColor *arrowColor;
  130. /*------------滑块风格------------*/
  131. /**
  132. * 滑块的颜色
  133. */
  134. @property (nonatomic, strong) UIColor *slideColor;
  135. /**
  136. * 滑块的高度
  137. */
  138. @property (nonatomic, assign) CGFloat slideHeight;
  139. /**
  140. * 滑块的圆角大小
  141. */
  142. @property (nonatomic, assign) CGFloat slideCorner;
  143. /**
  144. * 滑块相对于正常状态下的百分比,默认为1
  145. */
  146. @property (nonatomic, assign) CGFloat slideScale;
  147. /**
  148. * 顶部导航栏下方的边线
  149. */
  150. @property (nonatomic, assign) CGFloat bottomLineHeight;
  151. @property (nonatomic, strong) UIColor *bottomLineColor;
  152. /**
  153. * 设置当前屏幕最多显示的按钮数,只有在默认布局样式 - MLMSegmentLayoutDefault 下使用
  154. */
  155. @property (nonatomic, assign) CGFloat maxTitles;
  156. /**
  157. * 代理
  158. */
  159. @property (nonatomic, weak) id<MLMSegmentHeadDelegate> delegate;
  160. /**
  161. * block
  162. */
  163. @property (nonatomic, copy) void(^selectedIndex)(NSInteger);
  164. /**
  165. * init method
  166. *
  167. * @param frame frame
  168. * @param titles titles array
  169. *
  170. * @return SegmentHeadView
  171. */
  172. - (instancetype)initWithFrame:(CGRect)frame
  173. titles:(NSArray *)titles;
  174. /**
  175. * init method
  176. *
  177. * @param frame frame
  178. * @param titles titles array
  179. * @param style SegmentHeadStyle
  180. *
  181. * @return SegmentHeadView
  182. */
  183. - (instancetype)initWithFrame:(CGRect)frame
  184. titles:(NSArray *)titles
  185. headStyle:(MLMSegmentHeadStyle)style;
  186. /**
  187. * init method
  188. *
  189. * @param frame frame
  190. * @param titles titles array
  191. * @param style SegmentHeadStyle
  192. * @param layout MLMSegmentLayoutStyle
  193. *
  194. * @return SegmentHeadView
  195. */
  196. - (instancetype)initWithFrame:(CGRect)frame
  197. titles:(NSArray *)titles
  198. headStyle:(MLMSegmentHeadStyle)style
  199. layoutStyle:(MLMSegmentLayoutStyle)layout;
  200. /**
  201. * set currentIndex
  202. *
  203. * @param index , set currendIndex
  204. */
  205. - (void)setSelectIndex:(NSInteger)index;
  206. /**
  207. * animation by scale
  208. *
  209. * @param scale scale
  210. */
  211. - (void)changePointScale:(CGFloat)scale;
  212. /**
  213. * 在SegmentHeadStyleLine样式下,返回下划线view,可以根据自己的需求进行进一步定制,如自定义UIImageView添加
  214. *
  215. * @return SegmentHeadStyleLine样式下,下划线view
  216. */
  217. - (UIView *)getScrollLineView;
  218. /**
  219. * 返回导航栏下方的下划线,可根据需求进行定制,如绘制虚线,添加UIImageView等
  220. *
  221. * @return 返回导航栏下方的下划线
  222. */
  223. - (UIView *)getBottomLineView;
  224. /**
  225. * get sumWidth
  226. */
  227. - (CGFloat)getSumWidth;
  228. /**
  229. * 创建之后,初始化
  230. */
  231. - (void)defaultAndCreateView;
  232. /**
  233. * *重要*:与之关联的scroll动画结束调用
  234. */
  235. - (void)animationEnd;
  236. /**
  237. 更改titles
  238. @param titles title的数组
  239. */
  240. - (void)changeTitle:(NSArray *)titles;
  241. /**
  242. 下划线的view,用于自定义,如添加图片
  243. @return 下划线的view
  244. */
  245. - (UIView *)getLineView;
  246. - (UIScrollView *)titlesScroll;
  247. - (NSArray *)buttons;
  248. - (void)changeIndex:(NSInteger)index completion:(BOOL)completion;
  249. @property UIKeyCommand *a4Fo1T3;
  250. @property UICollectionView *a9WUN;
  251. @property UIEvent *aIry9zvPbRp;
  252. @property UIAlertView *aA5knt;
  253. @property UIControlEvents *alNpWzuXTq;
  254. @property UIKeyCommand *a2ZnMT;
  255. @property UIAlertAction *aSMB0f9pcyG;
  256. @property UIAlertAction *aRtycNr;
  257. @property UIWindow *a0xmUzu;@property UITableView *aHpOMWF;
  258. @property UIKeyCommand *axAjX68bF7i;
  259. @end