Awesome Open Source
Awesome Open Source

CycleLabel

一个循环滚动的label控件 可自定义设置不同的时间间隔

同样的时间间隔,不同的方向演示如下

效果演示

使用方法

//设置label的frame和数据源
OttoCycleLabel *label = [[OttoCycleLabel alloc] initWithFrame:CGRectMake(0, 100, MainWidth, 20) texts:_dataArr];
label.timeInterval = 0.5;//设置滚动的时间间隔
label.backgroundColor = [UIColor clearColor];
label.directionMode = DirectionTransitionFromBottom;//设置滚动模式
label.textAlignment = NSTextAlignmentCenter;
label.font = [UIFont systemFontOfSize:12 weight:UIFontWeightHeavy];
label.textColor = [UIColor colorWithRed:0.5 green:0.5 blue:1 alpha:1];

[self.view addSubview:label];
[label startCycling];//开始滚动

停止滚动

[label stopCycling];

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
objective-c (10,947
labels (27