Nessuna descrizione

MLMSegmentScroll.h 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. //
  2. // MLMSegmentScroll.h
  3. // MLMSegmentPage
  4. //
  5. // Created by my on 2017/2/6.
  6. // Copyright © 2017年 my. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. //添加子视图的时机
  10. typedef enum : NSUInteger {
  11. SegmentAddNormal,//滑动或者动画结束
  12. SegmentAddScale//根据设置滑动百分比添加0-1
  13. } SegmentAddTiming;
  14. @protocol MLMSegmentScrollDelegate <NSObject>
  15. @optional
  16. ///滑动结束
  17. - (void)scrollEndIndex:(NSInteger)index;
  18. ///动画结束
  19. - (void)animationEndIndex:(NSInteger)index;
  20. ///偏移的百分比
  21. - (void)scrollOffsetScale:(CGFloat)scale;
  22. @end
  23. @interface MLMSegmentScroll : UIScrollView
  24. ///第一次进入是否加载,YES加载countLimit个页面,默认 - NO
  25. @property (nonatomic, assign) BOOL loadAll;
  26. ///缓存页面数目,默认 - all
  27. @property (nonatomic, assign) NSInteger countLimit;
  28. ///默认显示开始的位置,默认 - 1
  29. @property (nonatomic, assign) NSInteger showIndex;
  30. ///delegate
  31. @property (nonatomic, weak) id<MLMSegmentScrollDelegate> segDelegate;
  32. ///blcok
  33. @property (nonatomic, copy) void(^scrollEnd)(NSInteger);
  34. @property (nonatomic, copy) void(^animationEnd)(NSInteger);
  35. @property (nonatomic, copy) void(^offsetScale)(CGFloat);
  36. ///添加时机,默认动画或者滑动结束添加
  37. @property (nonatomic, assign) SegmentAddTiming addTiming;
  38. ///SegmentAddScale 时使用
  39. @property (nonatomic, assign) CGFloat addScale;
  40. ///给一些vc设置属性,在创建的时候,在viewController或view传入的是类名的时候使用
  41. @property (nonatomic, copy) void(^initSource)(id vcOrview, NSInteger index);
  42. - (instancetype)initWithFrame:(CGRect)frame vcOrViews:(NSArray *)sources;
  43. - (void)changeSource:(NSArray *)sources;
  44. /**
  45. * 创建之后,初始化
  46. */
  47. - (void)createView;
  48. - (NSInteger)currentIndex;
  49. - (id)currentVcOrView;
  50. @end