UITableView+SCIndexView.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #import <UIKit/UIKit.h>
  2. #import "SCIndexViewConfiguration.h"
  3. @protocol SCTableViewSectionIndexDelegate
  4. /**
  5. 当点击或者滑动索引视图时,回调这个方法
  6. @param tableView 列表视图
  7. @param section 索引位置
  8. */
  9. - (void)tableView:(UITableView *)tableView didSelectIndexViewAtSection:(NSUInteger)section;
  10. /**
  11. 当滑动tableView时,索引位置改变,你需要自己返回索引位置时,实现此方法。
  12. 不实现此方法,或者方法的返回值为 SCIndexViewInvalidSection 时,索引位置将由控件内部自己计算。
  13. @param tableView 列表视图
  14. @return 索引位置
  15. */
  16. - (NSUInteger)sectionOfTableViewDidScroll:(UITableView *)tableView;
  17. @end
  18. @interface UITableView (SCIndexView)
  19. @property (nonatomic, weak) id<SCTableViewSectionIndexDelegate> sc_indexViewDelegate;
  20. // 索引视图数据源
  21. @property (nonatomic, copy) NSArray<NSString *> *sc_indexViewDataSource;
  22. // tableView在NavigationBar上是否半透明
  23. @property (nonatomic, assign) BOOL sc_translucentForTableViewInNavigationBar;
  24. // tableView从第几个section开始使用索引 Default = 0
  25. @property (nonatomic, assign) NSUInteger sc_startSection;
  26. // 索引视图的配置
  27. @property (nonatomic, strong) SCIndexViewConfiguration *sc_indexViewConfiguration;
  28. // 手动更新IndexView的CurrentSection
  29. - (void)sc_refreshCurrentSectionOfIndexView;
  30. @end