TYTabPagerBarLayout.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. //
  2. // TYTabPagerBarLayout.h
  3. // TYPagerControllerDemo
  4. //
  5. // Created by tanyang on 2017/7/17.
  6. // Copyright © 2017年 tany. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. #import "TYTabPagerBarCell.h"
  10. NS_ASSUME_NONNULL_BEGIN
  11. typedef NS_ENUM(NSUInteger, TYPagerBarStyle) {
  12. TYPagerBarStyleNoneView,
  13. TYPagerBarStyleProgressView,
  14. TYPagerBarStyleProgressBounceView,
  15. TYPagerBarStyleProgressElasticView,
  16. TYPagerBarStyleCoverView,
  17. };
  18. @class TYTabPagerBar;
  19. @interface TYTabPagerBarLayout : NSObject
  20. @property (nonatomic, weak, readonly) TYTabPagerBar *pagerTabBar;
  21. @property (nonatomic, assign, readonly) CGFloat selectFontScale;
  22. // set barStyle will reset propertys, so you should first time set it,
  23. @property (nonatomic, assign) TYPagerBarStyle barStyle; // default TYPagerBarStyleProgressElasticView
  24. @property (nonatomic, assign) UIEdgeInsets sectionInset;
  25. // progress view
  26. @property (nonatomic, assign) CGFloat progressHeight; // default 2
  27. @property (nonatomic, assign) CGFloat progressWidth; //if > 0 progress width is equal,else progress width is cell width
  28. @property (nonatomic, strong, nullable) UIColor *progressColor;
  29. @property (nonatomic, assign) CGFloat progressRadius; // height/2
  30. @property (nonatomic, assign) CGFloat progressBorderWidth;
  31. @property (nonatomic, strong, nullable) UIColor *progressBorderColor;
  32. @property (nonatomic, assign) CGFloat progressHorEdging; // default 6, if < 0 width + edge ,if >0 width - edge
  33. @property (nonatomic, assign) CGFloat progressVerEdging; // default 0, cover style is 3.
  34. // cell frame
  35. @property (nonatomic, assign) CGFloat cellWidth; // default 0, if > 0 cells width is equal,else if = 0 cell will call delegate
  36. @property (nonatomic, assign) CGFloat cellSpacing; // default 2,cell space
  37. @property (nonatomic, assign) CGFloat cellEdging; // default 0,cell left right edge
  38. @property (nonatomic, assign) BOOL adjustContentCellsCenter;// default NO, cells center if contentSize < bar's width ,will set sectionInset
  39. // TYTabPagerBarCellProtocol -> cell's label
  40. @property (nonatomic, strong) UIFont *normalTextFont; // default 15
  41. @property (nonatomic, strong) UIFont *selectedTextFont; // default 17
  42. @property (nonatomic, strong) UIColor *normalTextColor; // default 51.51.51
  43. @property (nonatomic, strong) UIColor *selectedTextColor; // default white
  44. @property (nonatomic, assign) BOOL textColorProgressEnable; // default YES
  45. // animate duration
  46. @property (nonatomic, assign) CGFloat animateDuration; // default 0.3
  47. - (instancetype)init NS_UNAVAILABLE;
  48. + (instancetype)new NS_UNAVAILABLE;
  49. - (instancetype)initWithPagerTabBar:(TYTabPagerBar *)pagerTabBar NS_DESIGNATED_INITIALIZER;
  50. - (void)layoutIfNeed;
  51. - (void)invalidateLayout;
  52. - (void)layoutSubViews;
  53. - (void)adjustContentCellsCenterInBar;
  54. // override
  55. - (void)transitionFromCell:(UICollectionViewCell<TYTabPagerBarCellProtocol> *_Nullable)fromCell toCell:(UICollectionViewCell<TYTabPagerBarCellProtocol> *_Nullable)toCell animate:(BOOL)animate;
  56. - (void)transitionFromCell:(UICollectionViewCell<TYTabPagerBarCellProtocol> *_Nullable)fromCell toCell:(UICollectionViewCell<TYTabPagerBarCellProtocol> *_Nullable)toCell progress:(CGFloat)progress;
  57. - (void)setUnderLineFrameWithIndex:(NSInteger)index animated:(BOOL)animated;
  58. - (void)setUnderLineFrameWithfromIndex:(NSInteger)fromIndex toIndex:(NSInteger)toIndex progress:(CGFloat)progress;
  59. @end
  60. NS_ASSUME_NONNULL_END