JhtVerticalMarquee.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. //
  2. // JhtVerticalMarquee.h
  3. // JhtMarquee
  4. //
  5. // GitHub主页: https://github.com/jinht
  6. // CSDN博客: http://blog.csdn.net/anticipate91
  7. //
  8. // Created by Zl on 2017/3/6.
  9. // Copyright © 2017年 JhtMarquee. All rights reserved.
  10. //
  11. #import <UIKit/UIKit.h>
  12. #import "JhtVerticalMarquee_Define.h"
  13. /** 纵向 跑马灯 */
  14. @interface JhtVerticalMarquee : UIView
  15. #pragma mark - Property
  16. #pragma mark required
  17. /** 跑马灯文字 数据源数组(支持attributedText && text混合) */
  18. @property (nonatomic, strong) NSArray *sourceArray;
  19. #pragma mark optional
  20. /** 当前展示内容 索引 */
  21. @property (nonatomic, assign, readonly) NSInteger currentIndex;
  22. /** 是否为逆时针滚动
  23. * default: NO
  24. * 顺时针: 底部 ===> 顶部
  25. * 逆时针: 顶部 ===> 底部
  26. */
  27. @property (nonatomic, assign, getter=isCounterclockwise) BOOL counterclockwise;
  28. /** 单次滚动 时间
  29. * default: 0.5f
  30. */
  31. @property (nonatomic, assign) CGFloat scrollDuration;
  32. /** 滚动延迟 时间
  33. * default: 3.0f
  34. */
  35. @property (nonatomic, assign) CGFloat scrollDelay;
  36. /** 文字 颜色
  37. * default: [UIColor blackColor]
  38. */
  39. @property (nonatomic, strong) UIColor *textColor;
  40. /** 文字 字体
  41. * default: [UIFont systemFontOfSize:14]
  42. */
  43. @property (nonatomic, strong) UIFont *textFont;
  44. /** 文字 对齐方式
  45. * default: NSTextAlignmentLeft
  46. */
  47. @property (nonatomic, assign) NSTextAlignment textAlignment;
  48. /** 文字 行数
  49. * default: 2(注意一下self.frame的设置)
  50. */
  51. @property (nonatomic, assign) NSInteger numberOfLines;
  52. #pragma mark - Public Method
  53. /** 设置跑马灯状态
  54. * marqueeState: 目标状态(MarqueeState_V)
  55. */
  56. - (void)marqueeOfSettingWithState:(MarqueeState_V)marqueeState;
  57. /** 滚动 回调 Block */
  58. typedef void(^verticalMarqueeBlock)(JhtVerticalMarquee *view, NSInteger currentIndex);
  59. - (void)scrollWithCallbackBlock:(verticalMarqueeBlock)block;
  60. @end