TYCyclePagerTransformLayout.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. //
  2. // TYCyclePagerViewLayout.h
  3. // TYCyclePagerViewDemo
  4. //
  5. // Created by tany on 2017/6/19.
  6. // Copyright © 2017年 tany. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. NS_ASSUME_NONNULL_BEGIN
  10. typedef NS_ENUM(NSUInteger, TYCyclePagerTransformLayoutType) {
  11. TYCyclePagerTransformLayoutNormal,
  12. TYCyclePagerTransformLayoutLinear,
  13. TYCyclePagerTransformLayoutCoverflow,
  14. };
  15. /// 滚动方向
  16. typedef NS_ENUM(NSUInteger, TYCyclePagerScrollDirection) {
  17. TYCyclePagerScrollDirectionHorizontal,
  18. TYCyclePagerScrollDirectionVertical
  19. };
  20. @class TYCyclePagerTransformLayout;
  21. @protocol TYCyclePagerTransformLayoutDelegate <NSObject>
  22. // initialize layout attributes
  23. - (void)pagerViewTransformLayout:(TYCyclePagerTransformLayout *)pagerViewTransformLayout initializeTransformAttributes:(UICollectionViewLayoutAttributes *)attributes;
  24. // apply layout attributes
  25. - (void)pagerViewTransformLayout:(TYCyclePagerTransformLayout *)pagerViewTransformLayout applyTransformToAttributes:(UICollectionViewLayoutAttributes *)attributes;
  26. @end
  27. @interface TYCyclePagerViewLayout : NSObject
  28. @property (nonatomic, assign) CGSize itemSize;
  29. @property (nonatomic, assign) CGFloat itemSpacing;
  30. @property (nonatomic, assign) UIEdgeInsets sectionInset;
  31. @property (nonatomic, assign) TYCyclePagerTransformLayoutType layoutType;
  32. @property (nonatomic, assign) CGFloat minimumScale; // sacle default 0.8
  33. @property (nonatomic, assign) CGFloat minimumAlpha; // alpha default 1.0
  34. @property (nonatomic, assign) CGFloat maximumAngle; // angle is % default 0.2
  35. @property (nonatomic, assign) BOOL isInfiniteLoop; // infinte scroll
  36. @property (nonatomic, assign) CGFloat rateOfChange; // scale and angle change rate
  37. @property (nonatomic, assign) BOOL adjustSpacingWhenScroling;
  38. /// 滚动方向,默认MFBannerViewScrollDirectionHorizontal水平滚动
  39. @property (nonatomic, assign) TYCyclePagerScrollDirection scrollDirection;
  40. /**
  41. pageView cell item vertical centering
  42. */
  43. @property (nonatomic, assign) BOOL itemVerticalCenter;
  44. /**
  45. first and last item horizontalc enter, when isInfiniteLoop is NO
  46. */
  47. @property (nonatomic, assign) BOOL itemHorizontalCenter;
  48. // sectionInset
  49. @property (nonatomic, assign, readonly) UIEdgeInsets onlyOneSectionInset;
  50. @property (nonatomic, assign, readonly) UIEdgeInsets firstSectionInset;
  51. @property (nonatomic, assign, readonly) UIEdgeInsets lastSectionInset;
  52. @property (nonatomic, assign, readonly) UIEdgeInsets middleSectionInset;
  53. @end
  54. @interface TYCyclePagerTransformLayout : UICollectionViewFlowLayout
  55. @property (nonatomic, strong) TYCyclePagerViewLayout *layout;
  56. @property (nonatomic, weak, nullable) id<TYCyclePagerTransformLayoutDelegate> delegate;
  57. @end
  58. NS_ASSUME_NONNULL_END