cdts/xdts-ios 3/Pods/JhtMarquee/README.md
2023-07-27 09:20:00 +08:00

130 lines
4.3 KiB
Markdown
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

## Marquee跑马灯
说一下初衷吧最初要用到跑马灯功能的时候也找过一些SDK但未能找到与我需求很好契合的SDK主要就是手势滑动后的问题手势滑动push/pop时候跑马灯出现失灵的状况目前支持水平 && 上下(正向 && 逆向滚动解决push/pop && 前后台切换 && 手势滑动 && 意外中断等情况希望通过此SDK给予与我有同样需求的童鞋一些帮助。
<br>
### 先上图,看一下是否符合你的场景吧!
<img src="https://raw.githubusercontent.com/jinht/Marquee/master/ReadMEImages/1.gif" width=240 height=426 />
### Function Description
1. 轻量级跑马灯
2. 支持attributedText
3. 随时获取跑马灯状态
4. 前/后台切换重新加载
5. 水平 && 上下(正向 && 逆向)
6. push/pop || 前后台切换 || 手势返回后自动滚动<br>
## How to use
### 1. podfile
```oc
platform:ios, '8.0'
target '*****' do
pod 'JhtMarquee'
end
```
### 2. 水平:水平向左滚动的跑马灯
#### a. 简单的集成方式当成一个普通label使用即可在初始化方法的时候可以自定义单次滚动时间
```oc
/** 初始化
* duration: 单次滚动时间
* 注: duration = 0.0,使用内部自适应计算功能
*/
- (instancetype)initWithFrame:(CGRect)frame withSingleScrollDuration:(NSTimeInterval)duration;
```
#### b. 状态自由设置:通过以下方法传入相应的`MarqueeState_H`枚举值即可
```oc
/** 设置跑马灯状态
* marqueeState跑马灯状态枚举
* 注“开启跑马灯”放在viewDidAppear中“关闭跑马灯”放在viewWillDisappear中
*/
- (void)marqueeOfSettingWithState:(MarqueeState_H)marqueeState;
```
*demo中有详细使用的方法集成的时候按其方式使用即可此外还要注意一下`开启/关闭跑马灯`方法放置的函数
```oc
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
// 开启跑马灯
[_marquee marqueeOfSettingWithState:MarqueeStart];
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
// 关闭跑马灯
[_marquee marqueeOfSettingWithState:MarqueeShutDown];
}
```
### 3. 上下:上下(正向 && 逆向)滚动的跑马灯
#### a. 简单的集成方式:正常初始化后,传入滚动文字的数据源数组即可
#### b. 状态自由设置:通过以下方法传入相应的`MarqueeState_V`枚举值即可
```oc
/** 设置跑马灯状态
* marqueeState跑马灯状态枚举
*/
- (void)marqueeOfSettingWithState:(MarqueeState_V)marqueeState;
```
#### c. 实时回调:通过`index`属性和`scrollWithCallbackBlock`方法可以实时获取当前展示文字在数据源数组中的位置
```oc
/** 当前显示展示的文字在数据源数组中的索引_只读 */
@property (nonatomic, assign) NSInteger index;
/** 每次滚动回调的Block */
- (void)scrollWithCallbackBlock:(verticalMarqueeBlock)block;
```
#### d. 个性化设置:可通过以下属性进行个性化的设置
```oc
/** 是否为逆时针滚动defaultNO
* 顺时针:底部 ===> 顶部
* 逆时针:顶部 ===> 底部
*/
@property (nonatomic, assign) BOOL isCounterclockwise;
/** 单次滚动时间default0.5f */
@property (nonatomic, assign) CGFloat scrollDuration;
/** 滚动延迟default2.5f */
@property (nonatomic, assign) CGFloat scrollDelay;
/** 滚动字的颜色defaultblackColor */
@property (nonatomic, strong) UIColor *verticalTextColor;
/** 滚动的字体default14 */
@property (nonatomic, strong) UIFont *verticalTextFont;
/** 显示内容的对齐方式defaultNSTextAlignmentLeft */
@property (nonatomic, assign) NSTextAlignment verticalTextAlignment;
/** 显示内容的行数default2 */
@property (nonatomic, assign) NSInteger verticalNumberOfLines;
```
* 在demo中可以查看具体使用方法使用demo之前请先 **pod install**
### Remind
* ARC
* iOS >= 8.0
* iPhone \ iPad
## Hope
* If you find bug when usedHope you can Issues meThank you or try to download the latest code of this framework to see the BUG has been fixed or not
* If you find the function is not enough when usedHope you can Issues meI very much to add more useful function to this framework Thank you !