[翻译] ValueTrackingSlider
ValueTrackingSlider
What is it?
A UISlider Subclass that displays live values in a popUpView. It’s inspired by the implementation found here. This version is built using CALayers, it offers a few more features and it's easy to customize the appearance.
一个继承自UISlider的子类,通过弹出一个View动态实时显示值的改变,灵感来自于这里(here)。这个呢实际上使用了许多CALayer,能提供一些特性供你定制,当然呢,自定义也是很简单的事情。

Features
- Live updating of UISlider value
- Customizable properties:
- textColor
- font
- popUpViewColor
- popUpViewAnimatedColors - popUpView and UISlider track color animate as value changes
- Set your own NSNumberFormatter to control the displayed values
- Wholesome springy animation
- 实时更新UISlider的值
- 可以改变的一些属性(字体颜色,字体,弹出View的颜色,弹出的View随着动画而改变的颜色)
- 设置你自己的NSNumberFormatter来控制显示的值
- 健全并附有弹性的动画效果
Which files are needed?
For CocoaPods users, simply add pod 'ASValueTrackingSlider' to your podfile. If you'd like to test the included demo project before including it in your own work, then type $ pod try ASValueTrackingSlider in your terminal. CocoaPods will download the demo project into a temp folder and open it in Xcode. Magic.
If you don't use CocoaPods, just include these files in your project:
添加以下两个文件到你的工程项目中即可:
- ASValueTrackingSlider (.h .m)
- ASValuePopUpView (.h .m)
How to use it
It’s very simple. Drag a UISlider into your Storyboard/nib and set its class to ASValueTrackingSlider – that's it. The examples below demonstrate how to customize the appearance and value displayed.
使用非常简单。拖一个UISlider的空间到Storyboard或者nib文件,设置class为ASValueTrackingSlider ,这就完了。下面的例子列举了如何定制样式以及值的改变范围。
self.slider.maximumValue = 255.0;
[self.slider setMaxFractionDigitsDisplayed:0];
self.slider.popUpViewColor = [UIColor colorWithHue:0.55 saturation:0.8 brightness:0.9 alpha:0.7];
self.slider.font = [UIFont fontWithName:@"Menlo-Bold" size:22];
self.slider.textColor = [UIColor colorWithHue:0.55 saturation:1.0 brightness:0.5 alpha:1];

NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
[formatter setNumberStyle:NSNumberFormatterPercentStyle];
[self.slider setNumberFormatter:formatter];
self.slider.popUpViewAnimatedColors = @[[UIColor purpleColor], [UIColor redColor], [UIColor orangeColor]];
self.slider.font = [UIFont fontWithName:@"Futura-CondensedExtraBold" size:26];

[翻译] ValueTrackingSlider的更多相关文章
- 《Django By Example》第五章 中文 翻译 (个人学习,渣翻)
书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者@ucag注:大家好,我是新来的翻译, ...
- 《Django By Example》第四章 中文 翻译 (个人学习,渣翻)
书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:祝大家新年快乐,这次带来<D ...
- [翻译]开发文档:android Bitmap的高效使用
内容概述 本文内容来自开发文档"Traning > Displaying Bitmaps Efficiently",包括大尺寸Bitmap的高效加载,图片的异步加载和数据缓存 ...
- 【探索】机器指令翻译成 JavaScript
前言 前些时候研究脚本混淆时,打算先学一些「程序流程」相关的概念.为了不因太枯燥而放弃,决定想一个有趣的案例,可以边探索边学. 于是想了一个话题:尝试将机器指令 1:1 翻译 成 JavaScript ...
- 《Django By Example》第三章 中文 翻译 (个人学习,渣翻)
书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:第三章滚烫出炉,大家请不要吐槽文中 ...
- 《Django By Example》第二章 中文 翻译 (个人学习,渣翻)
书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:翻译完第一章后,发现翻译第二章的速 ...
- 《Django By Example》第一章 中文 翻译 (个人学习,渣翻)
书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:本人目前在杭州某家互联网公司工作, ...
- 【翻译】Awesome R资源大全中文版来了,全球最火的R工具包一网打尽,超过300+工具,还在等什么?
0.前言 虽然很早就知道R被微软收购,也很早知道R在统计分析处理方面很强大,开始一直没有行动过...直到 直到12月初在微软技术大会,看到我软的工程师演示R的使用,我就震惊了,然后最近在网上到处了解和 ...
- ASP.NET MVC with Entity Framework and CSS一书翻译系列文章之第一章:创建基本的MVC Web站点
在这一章中,我们将学习如何使用基架快速搭建和运行一个简单的Microsoft ASP.NET MVC Web站点.在我们马上投入学习和编码之前,我们首先了解一些有关ASP.NET MVC和Entity ...
随机推荐
- ARM的体系结构与编程系列博客——ARM的历史与应用范围
前言 最近我感觉自己比较浮躁,重来没有好好地沉下心来做一件事情,而且针对自己在专业水平上仍然还有很多欠缺,于是我想我应该为自己做些什么来证明一下自己真的是潜心研究东西的人,于是我萌生了一个想法,真正地 ...
- MyEclipse中快速查看错误
当代码中有错误的时候,MyEclipse会用红线标示错误.这个时候在错误地方按下F2就会显示错误详情了.
- Spring系列之——spring security
1 搭建springboot 2 配置pom依赖(springboot版本为2.1.3) <dependency> <groupId>org.springframework.b ...
- Recommend ways to overwrite hashCode() in java
Perface In the former chapter, I talk about topics about hashCode, And I will continue to finish the ...
- golang使用graphviz
graphviz的介绍请参考: http://www.cnblogs.com/ghj1976/p/4539788.html 安装 graphviz 需要在 http://www.graphviz.o ...
- ARM体系结构和汇编指令
第一节 可编程器件的编程原理 1. 可编程器件的特点 1 . CPU在固定频率的时钟控制下节奏运行 2 . CPU可以通过总线读取外部存储设备中的二进制指令集,然后解码执行 3 . 这些可以被CPU解 ...
- Code Signal_练习题_All Longest Strings
Given an array of strings, return another array containing all of its longest strings. Example For i ...
- python中面向切片编程(AOP)和装饰器
@函数名(类的描述符)相当于fuc = decorator(fuc) 装饰器: def deco(fuc): print('============') return fuc @deco def fo ...
- [微信小程序] 微信小程序富文本-wxParse的使用
最近小程序蛮火的,公司要做于是学了一点点小程序 不知道你们有没有遇到过这种问题: 从公司服务器获取的文章内容是有HTML标签格式的一段内容,但是微信是不支持这些标签的,怎么办呢? 1.一般网站后台的文 ...
- 换算rem的宽度和高度不生效 chrome字体最小为12px
现在很多前端都用rem来单位元素和字体大小 一般的设置是 html{ font-size:62.5%; } 换算来源 1rem = 16px 10/16 = 0.625 这样10px 就等于了1rem ...
