CGXVerticalMenuCollectionView.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. //
  2. // CGXVerticalMenuCollectionView.h
  3. // CGXVerticalMenuView-OC
  4. //
  5. // Created by CGX on 2018/05/01.
  6. // Copyright © 2019 CGX. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. #import "CGXVerticalMenuCollectionSectionModel.h"
  10. #import "CGXVerticalMenuCollectionItemModel.h"
  11. #import "CGXVerticalMenuCustomCollectionView.h"
  12. NS_ASSUME_NONNULL_BEGIN
  13. @class CGXVerticalMenuCollectionView;
  14. @protocol CGXVerticalMenuCollectionViewDataSouce <NSObject>
  15. @optional
  16. /** 如果你需要自定义cell样式,请在实现此代理方法返回你的自定义cell的class。 */
  17. - (Class)customcategoryRightViewCollectionViewCellClass;
  18. /** 如果你需要自定义cell样式,请在实现此代理方法返回你的自定义cell的Nib。 */
  19. - (Class)customcategoryRightViewCollectionViewCellNib;
  20. /**
  21. 每个分区自定义cell
  22. */
  23. - (UICollectionViewCell *)categoryRightView:(CGXVerticalMenuCollectionView *)categoryView cellForItemAtIndexPath:(NSIndexPath *)indexPath;
  24. /**
  25. 每个分区头自定义view
  26. */
  27. - (UICollectionReusableView *)categoryRightView:(CGXVerticalMenuCollectionView *)categoryView KindHeadAtIndexPath:(NSIndexPath *)indexPath;
  28. /**
  29. 每个分区脚自定义view
  30. */
  31. - (UICollectionReusableView *)categoryRightView:(CGXVerticalMenuCollectionView *)categoryView KindFootAtIndexPath:(NSIndexPath *)indexPath;
  32. /**
  33. 每个分区背景颜色 默认背景色
  34. */
  35. - (UIColor *)categoryRightView:(CGXVerticalMenuCollectionView *)categoryView BackgroundColorForSection:(NSInteger)section;
  36. /**
  37. 每个分区的高度 不实现 默认宽高相等
  38. */
  39. - (CGFloat)categoryRightView:(CGXVerticalMenuCollectionView *)categoryView sizeForItemAtSection:(NSInteger)section ItemWidth:(CGFloat)itemWidth;
  40. @end
  41. @protocol CGXVerticalMenuCollectionViewDelegate <NSObject>
  42. @optional
  43. /**
  44. 点击选中的情况才会调用该方法
  45. @param categoryView categoryView description
  46. @param indexPath 选中的index
  47. */
  48. - (void)categoryRightView:(CGXVerticalMenuCollectionView *)categoryView didClickSelectedItemAtIndexPath:(NSIndexPath *)indexPath;
  49. /**
  50. 背景图点击事件
  51. @param categoryView categoryView description
  52. @param indexPath 点击背景图的indexPath
  53. */
  54. - (void)categoryRightView:(CGXVerticalMenuCollectionView *)categoryView didSelectDecorationViewAtIndexPath:(NSIndexPath *)indexPath;
  55. - (void)categoryRightView:(CGXVerticalMenuCollectionView *)categoryView dropUpDownDidChanged:(CGPoint)contentOffset;
  56. /**滚动情况才会调用该方法*/
  57. - (void)categoryRightView:(CGXVerticalMenuCollectionView *)categoryView
  58. ScrollViewDidScroll:(UIScrollView *)scrollView;
  59. // CollectionView分区标题即将展示
  60. - (void)categoryRightView:(CGXVerticalMenuCollectionView *)categoryView willDisplaySupplementaryView:(UICollectionReusableView *)view
  61. forElementKind:(NSString *)elementKind
  62. atIndexPath:(NSIndexPath *)indexPath;
  63. // CollectionView分区标题展示结束
  64. - (void)categoryRightView:(CGXVerticalMenuCollectionView *)categoryView didEndDisplayingSupplementaryView:(UICollectionReusableView *)view
  65. forElementOfKind:(NSString *)elementKind
  66. atIndexPath:(NSIndexPath *)indexPath;
  67. -(void)categoryRightView:(CGXVerticalMenuCollectionView *)categoryView scrollViewWillBeginDragging:(UIScrollView *)scrollView;
  68. -(void)categoryRightView:(CGXVerticalMenuCollectionView *)categoryView scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView;
  69. -(void)categoryRightView:(CGXVerticalMenuCollectionView *)categoryView scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate;
  70. -(void)categoryRightView:(CGXVerticalMenuCollectionView *)categoryView scrollViewDidEndDecelerating:(UIScrollView *)scrollView;
  71. @end
  72. @interface CGXVerticalMenuCollectionView : UIView<UICollectionViewDataSource,UICollectionViewDelegate,UICollectionViewDelegateFlowLayout>
  73. @property (nonatomic, strong,readonly) CGXVerticalMenuCustomCollectionView *collectionView;
  74. @property (nonatomic, strong,readonly) NSMutableArray <CGXVerticalMenuCollectionSectionModel *> *dataArray;
  75. @property (nonatomic, weak) id<CGXVerticalMenuCollectionViewDelegate> delegate;
  76. @property (nonatomic, weak) id<CGXVerticalMenuCollectionViewDataSouce> dataSouce;
  77. /*
  78. 自定义cell 必须实现
  79. */
  80. - (void)registerCell:(Class)classCell IsXib:(BOOL)isXib;
  81. - (void)updateRightWithDataArray:(NSMutableArray<CGXVerticalMenuCollectionSectionModel *> *)dataArray;
  82. @end
  83. NS_ASSUME_NONNULL_END