美文网首页GitHub上有趣的资源UI进价iOS Developer
SYNoticeBrowseLabel跑马灯公告栏标签

SYNoticeBrowseLabel跑马灯公告栏标签

作者: 番薯大佬 | 来源:发表于2017-07-14 11:34 被阅读111次

    SYNoticeBrowseLabel

    跑马灯公告栏标签,可以设置图标、标题与内容。
    图标设置是一个数组类型,多张图时表示动态图,单张图时,表示静态图。
    标题与内容设置时,可以根据需要设置字体大小与颜色。
    跑马灯还可以设置动画延迟时间和跑马灯运行时间。

    效果图效果图

    使用代码示例
    导入头文件

    #import "SYNoticeBrowseLabel.h"
    

    实例化

    SYNoticeBrowseLabel *noticeLabel = [[SYNoticeBrowseLabel alloc] initWithFrame:CGRectMake(10.0, 10.0, (self.view.frame.size.width - 10.0 * 2), 30.0)];
    [self.view addSubview:noticeLabel2];
    noticeLabel.backgroundColor = [UIColor colorWithWhite:0.5 alpha:0.3];
    

    公告内容属性设置

    // 公告字体颜色
    noticeLabel.textColor = [UIColor purpleColor];
    // 公告字体大小
    noticeLabel.textFont = [UIFont systemFontOfSize:15.0];
    // 公告内容
    noticeLabel.text = @"自定义跑马灯功能类标签。";
    

    公告图标属性设置,可以设置动图,也可以设置静态图

    noticeLabel.images = @[[UIImage imageNamed:@"face01"], [UIImage imageNamed:@"face02"], [UIImage imageNamed:@"face03"], [UIImage imageNamed:@"face04"], [UIImage imageNamed:@"face05"], [UIImage imageNamed:@"face06"]];
    

    公告标题属性设置

    // 公告标题
    noticeLabel.title = @"公告";
    // 公告标题字体颜色
    noticeLabel.titleColor = [UIColor brownColor];
    // 公告标题字体大小
    noticeLabel.titleFont = [UIFont systemFontOfSize:12.0];
    // 标题与内容分割线颜色
    noticeLabel.lineColor = [UIColor purpleColor];
    

    响应交互操作设置

    // 点击公告内容时是否暂停动画(默认不停NO)
    noticeLabel.textAnimationPauseWhileClick = NO;
    // 点击公告内容时的回调
    noticeLabel.textClick = ^(){
          [[[UIAlertView alloc] initWithTitle:nil message:@"点击时,动画不受影响。" delegate:nil cancelButtonTitle:@"知道了" otherButtonTitles:nil, nil] show];
    };
    

    跑马灯动画时间属性设置

    // 延迟时间
    noticeLabel.delayTime = 2.0;
    // 动画
    [noticeLabel textAnimation:6.0];
    

    相关文章

      网友评论

        本文标题:SYNoticeBrowseLabel跑马灯公告栏标签

        本文链接:https://www.haomeiwen.com/subject/otmnhxtx.html