WCScrollLabelView 0.2.3

WCScrollLabelView 0.2.3

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Nov 2017

Maintained by qiao.


Downloads

Total34
Week0
Month1

Installs

Apps4
powered by Segment

GitHub

Stars3
Watchers1
Forks0
Issues0
Contributors1
Pull Requests0

Code

Files2
LOCLines of Code 172


  • By
  • qiao

WCScrollLabelView

上下滚动的label

导入

pod 'WCScrollLabelView'

使用

    NSArray *titles = @[@"这是第一条这是第一条这是第一条这是第一条",@"这是第二条",@"这是第三条",@"这是第四条"];
    
    scrollLabelView = [[WCScrollLabelView alloc] initWithFrame:CGRectMake(50, 100, 200, 50)];
    scrollLabelView.backgroundColor = [UIColor whiteColor];
    scrollLabelView.delegate = self;
    scrollLabelView.titleArray = titles;
    //设置label的字体
    scrollLabelView.titleFont = [UIFont systemFontOfSize:15];
    //设置文字颜色
    scrollLabelView.titleColor = [UIColor redColor];
    //设置停留时间
    scrollLabelView.stayInterval = 3.f;
    //设置滚动动画时间
    scrollLabelView.animationDuration = 1.f;
    //设置对齐方式
    scrollLabelView.textAligment = NSTextAlignmentCenter;
    //设置内边距
    scrollLabelView.contentInsets = UIEdgeInsetsMake(5, 10, 5, 10);
    [self.view addSubview:scrollLabelView];
    //开始滚动
    [scrollLabelView beginScrolling];

代理

- (void)scrollLabelView:(WCScrollLabelView *)scrollLabelView didClickAtIndex:(NSInteger)index
{
    NSLog(@"点击%zd",index);
}

效果图

image