新UI马甲包

FSSegmentTitleView.h 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. //
  2. // FSSegmentTitleView.h
  3. // FSScrollContentViewDemo
  4. //
  5. // Created by huim on 2017/5/3.
  6. // Copyright © 2017年 fengshun. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. @class FSSegmentTitleView;
  10. typedef enum : NSUInteger {
  11. FSIndicatorTypeDefault,//默认与按钮长度相同
  12. FSIndicatorTypeEqualTitle,//与文字长度相同
  13. FSIndicatorTypeCustom,//自定义文字边缘延伸宽度
  14. FSIndicatorTypeNone,
  15. } FSIndicatorType;//指示器类型枚举
  16. @protocol FSSegmentTitleViewDelegate <NSObject>
  17. @optional
  18. /**
  19. 切换标题
  20. @param titleView FSSegmentTitleView
  21. @param startIndex 切换前标题索引
  22. @param endIndex 切换后标题索引
  23. */
  24. - (void)FSSegmentTitleView:(FSSegmentTitleView *)titleView startIndex:(NSInteger)startIndex endIndex:(NSInteger)endIndex;
  25. @end
  26. @interface FSSegmentTitleView : UIView
  27. @property (nonatomic, weak) id<FSSegmentTitleViewDelegate>delegate;
  28. /**
  29. 标题文字间距,默认20
  30. */
  31. @property (nonatomic, assign) CGFloat itemMargin;
  32. /**
  33. 当前选中标题索引,默认0
  34. */
  35. @property (nonatomic, assign) NSInteger selectIndex;
  36. /**
  37. 标题字体大小,默认15
  38. */
  39. @property (nonatomic, strong) UIFont *titleFont;
  40. /**
  41. 标题选中字体大小,默认15
  42. */
  43. @property (nonatomic, strong) UIFont *titleSelectFont;
  44. /**
  45. 标题正常颜色,默认black
  46. */
  47. @property (nonatomic, strong) UIColor *titleNormalColor;
  48. /**
  49. 标题选中颜色,默认red
  50. */
  51. @property (nonatomic, strong) UIColor *titleSelectColor;
  52. /**
  53. 指示器颜色,默认与titleSelectColor一样,在FSIndicatorTypeNone下无效
  54. */
  55. @property (nonatomic, strong) UIColor *indicatorColor;
  56. /**
  57. 在FSIndicatorTypeCustom时可自定义此属性,为指示器一端延伸长度,默认5
  58. */
  59. @property (nonatomic, assign) CGFloat indicatorExtension;
  60. /**
  61. 对象方法创建FSSegmentTitleView
  62. @param frame frame
  63. @param titlesArr 标题数组
  64. @param delegate delegate
  65. @param incatorType 指示器类型
  66. @return FSSegmentTitleView
  67. */
  68. - (instancetype)initWithFrame:(CGRect)frame titles:(NSArray *)titlesArr delegate:(id<FSSegmentTitleViewDelegate>)delegate indicatorType:(FSIndicatorType)incatorType;
  69. @end