iOS中 高仿Tumblr热度-滚动条数-JQScrollNumberLabel 韩俊强的博客

    xiaoxiao2021-04-18  68

    上一篇:高仿Tumblr点赞心破碎动画 

    最近Tumblr轻博客无论是web端还是移动端,都非常受欢迎,简单调研了一下,此篇是关于滚动热点条数的动画;

    JQScrollNumberLabel

    简介:

    JQScrollNumberLabel 仿tumblr热度滚动数字条数,一个显示数字的控件,当你改变其数字时,能够有滚动的动画,同时动画和位数可以限制,动态创建和实例化可选,字体样式自定义等等。

    效果展示

    限制位数:Limit digit

    动态创建位数:Dynamic creation bit

    仿Tumblr中的热度-滚动数字:Imitation Tumblr in the heat - rolling number

    How to use?

    将JQScrollNumberLabel文件夹中的两个文件复制进工程,在需要使用的地方导入头文件

    #import "JQScrollNumberLabel.h" @interface ViewController () @property (nonatomic, strong)JQScrollNumberLabel *scrollLabel; @end

    初始化的方法传人字体大小或是一个字体,不要设置其frame,只需改变其位置即可,因为它是根据字体大小自动计算自身的大小,若想动态设置位数不要带rowNumber参数即可:

    @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; self.scrollLabel = [[JQScrollNumberLabel alloc] initWithNumber:@(1) font:[UIFont fontWithName:@"AppleSDGothicNeo-SemiBold" size:40] textColor:[UIColor grayColor] rowNumber:5]; self.scrollLabel.frame = CGRectMake(100, 100, self.scrollLabel.frame.size.width, self.scrollLabel.frame.size.height); [self.view addSubview:self.scrollLabel]; } @end

    当想要改变其数值时,调用下面方法即可,当animated参数为NO时不会播放动画

    [self.scrollLabel changeToNumber:@(10) animated:YES]; QT

    1.目前还不支持负数的显示

    2.显示的位数有限制,最大8位

    Consultation

                                                          详情请看Demo:喜欢❤️star一下吧,你的支持是我最大的动力!

                                                          更多:每周更新关注新浪微博!iOS开发者交流群:446310206

          韩俊强 认证博客专家 博客之星 十佳专栏 阿里云MVP 博客专家,阿里云MVP,2016年博客之星,2017年十佳专栏。官方QQ群:446310206/426087546
    转载请注明原文地址: https://ju.6miu.com/read-675282.html

    最新回复(0)