MenuSegmentView.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. //
  2. // MenuSegmentView.h
  3. // DDTG
  4. //
  5. // Created by 翟玉磊 on 16/5/11.
  6. // Copyright © 2016年 翟玉磊. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. typedef void(^ButtonOnClickBlock)(NSInteger tag, NSString *title);
  10. typedef void(^SelectIndexBlock)(NSInteger tag);
  11. @interface MenuSegmentView : UIView
  12. @property (nonatomic, strong) NSArray *titles;
  13. @property (nonatomic, strong) UIColor *titleDefaultColor;
  14. @property (nonatomic, strong) UIColor *titleSelectColor;
  15. @property (nonatomic, strong) UIFont *titleFont;
  16. @property (nonatomic, assign) CGFloat duration;
  17. /// 默认2
  18. @property (nonatomic, readwrite, assign) CGFloat selectedLineHeight;
  19. /// 是否显示底部分割线 默认显示YES
  20. @property (nonatomic, readwrite) BOOL isShowBottomLine;
  21. - (instancetype)initWithFrame:(CGRect)frame titles:(NSArray *)array;
  22. /**
  23. * 点击按钮的回调
  24. *
  25. * @param block 点击按钮的Block
  26. */
  27. - (void)setButtonOnClickBlock:(ButtonOnClickBlock)block;
  28. - (void)setSelectIndexBlock:(SelectIndexBlock)block;
  29. - (void)setSelectedItemIndex:(int)page;
  30. - (void)updateTitlesWithData:(NSArray *)array;
  31. /**
  32. 显示或者隐藏指定索引的红点
  33. @param index 索引
  34. @param status YES显示 NO隐藏
  35. */
  36. - (void)updateBadgeWithIndex:(NSInteger)index status:(BOOL)status;
  37. @end