TYCyclePagerTransformLayout.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. @class TYCyclePagerTransformLayout;
  16. @protocol TYCyclePagerTransformLayoutDelegate <NSObject>
  17. // initialize layout attributes
  18. - (void)pagerViewTransformLayout:(TYCyclePagerTransformLayout *)pagerViewTransformLayout initializeTransformAttributes:(UICollectionViewLayoutAttributes *)attributes;
  19. // apply layout attributes
  20. - (void)pagerViewTransformLayout:(TYCyclePagerTransformLayout *)pagerViewTransformLayout applyTransformToAttributes:(UICollectionViewLayoutAttributes *)attributes;
  21. @end
  22. @interface TYCyclePagerViewLayout : NSObject
  23. @property (nonatomic, assign) CGSize itemSize;
  24. @property (nonatomic, assign) CGFloat itemSpacing;
  25. @property (nonatomic, assign) UIEdgeInsets sectionInset;
  26. @property (nonatomic, assign) TYCyclePagerTransformLayoutType layoutType;
  27. @property (nonatomic, assign) CGFloat minimumScale; // sacle default 0.8
  28. @property (nonatomic, assign) CGFloat minimumAlpha; // alpha default 1.0
  29. @property (nonatomic, assign) CGFloat maximumAngle; // angle is % default 0.2
  30. @property (nonatomic, assign) BOOL isInfiniteLoop; // infinte scroll
  31. @property (nonatomic, assign) CGFloat rateOfChange; // scale and angle change rate
  32. @property (nonatomic, assign) BOOL adjustSpacingWhenScroling;
  33. /**
  34. pageView cell item vertical centering
  35. */
  36. @property (nonatomic, assign) BOOL itemVerticalCenter;
  37. /**
  38. first and last item horizontalc enter, when isInfiniteLoop is NO
  39. */
  40. @property (nonatomic, assign) BOOL itemHorizontalCenter;
  41. // sectionInset
  42. @property (nonatomic, assign, readonly) UIEdgeInsets onlyOneSectionInset;
  43. @property (nonatomic, assign, readonly) UIEdgeInsets firstSectionInset;
  44. @property (nonatomic, assign, readonly) UIEdgeInsets lastSectionInset;
  45. @property (nonatomic, assign, readonly) UIEdgeInsets middleSectionInset;
  46. @end
  47. @interface TYCyclePagerTransformLayout : UICollectionViewFlowLayout
  48. @property (nonatomic, strong) TYCyclePagerViewLayout *layout;
  49. @property (nonatomic, weak, nullable) id<TYCyclePagerTransformLayoutDelegate> delegate;
  50. @end
  51. NS_ASSUME_NONNULL_END