口袋优选

SGPageTitleView.h 3.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. //
  2. // 如遇到问题或有更好方案,请通过以下方式进行联系
  3. // QQ群:429899752
  4. // Email:kingsic@126.com
  5. // GitHub:https://github.com/kingsic/SGPagingView
  6. //
  7. // SGPageTitleView.h
  8. // SGPagingViewExample
  9. //
  10. // Created by kingsic on 17/4/10.
  11. // Copyright © 2017年 kingsic. All rights reserved.
  12. //
  13. #import <UIKit/UIKit.h>
  14. @class SGPageTitleViewConfigure, SGPageTitleView;
  15. @protocol SGPageTitleViewDelegate <NSObject>
  16. /**
  17. * 联动 pageContent 的方法
  18. *
  19. * @param pageTitleView SGPageTitleView
  20. * @param selectedIndex 选中按钮的下标
  21. */
  22. - (void)pageTitleView:(SGPageTitleView *)pageTitleView selectedIndex:(NSInteger)selectedIndex;
  23. @end
  24. @interface SGPageTitleView : UIView
  25. /// SGPageTitleView 配置信息
  26. @property (nonatomic, readonly, strong) SGPageTitleViewConfigure *configure;
  27. /**
  28. * 对象方法创建 SGPageTitleView
  29. *
  30. * @param frame frame
  31. * @param delegate delegate
  32. * @param titleNames 标题数组
  33. * @param configure SGPageTitleView 信息配置
  34. */
  35. - (instancetype)initWithFrame:(CGRect)frame delegate:(id<SGPageTitleViewDelegate>)delegate titleNames:(NSArray *)titleNames configure:(SGPageTitleViewConfigure *)configure;
  36. /**
  37. * 类方法创建 SGPageTitleView
  38. *
  39. * @param frame frame
  40. * @param delegate delegate
  41. * @param titleNames 标题数组
  42. * @param configure SGPageTitleView 信息配置
  43. */
  44. + (instancetype)pageTitleViewWithFrame:(CGRect)frame delegate:(id<SGPageTitleViewDelegate>)delegate titleNames:(NSArray *)titleNames configure:(SGPageTitleViewConfigure *)configure;
  45. /** SGPageTitleView 是否需要弹性效果,默认为 YES */
  46. @property (nonatomic, assign) BOOL isNeedBounces;
  47. /** 选中标题按钮下标,默认为 0 */
  48. @property (nonatomic, assign) NSInteger selectedIndex;
  49. /** 重置选中标题按钮下标(用于子控制器内的点击事件改变标题的选中下标)*/
  50. @property (nonatomic, assign) NSInteger resetSelectedIndex;
  51. /** 是否让标题按钮文字有渐变效果,默认为 YES */
  52. @property (nonatomic, assign) BOOL isTitleGradientEffect;
  53. /** 是否开启标题按钮文字缩放效果,默认为 NO */
  54. @property (nonatomic, assign) BOOL isOpenTitleTextZoom;
  55. /** 标题文字缩放比,默认为 0.1f,取值范围 0 ~ 0.3f */
  56. @property (nonatomic, assign) CGFloat titleTextScaling;
  57. /** 是否显示指示器,默认为 YES */
  58. @property (nonatomic, assign) BOOL isShowIndicator;
  59. /** 是否显示底部分割线,默认为 YES */
  60. @property (nonatomic, assign) BOOL isShowBottomSeparator;
  61. @property (nonatomic, assign) NSInteger newSelectedIndex;
  62. /** 给外界提供的方法,获取 SGPageContentView 的 progress/originalIndex/targetIndex, 必须实现 */
  63. - (void)setPageTitleViewWithProgress:(CGFloat)progress originalIndex:(NSInteger)originalIndex targetIndex:(NSInteger)targetIndex;
  64. /** 根据下标重置标题文字(index 标题所对应的下标值、title 新的标题名)*/
  65. - (void)resetTitleWithIndex:(NSInteger)index newTitle:(NSString *)title;
  66. @end