[翻译] 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 ...
随机推荐
- IntelliJ IDEA使用心得之问题篇;
在使用IDEA的时候,难免会遇到一些问题,总结下来,一是备忘,而是分享. 1.IDEA代码编辑区无法编辑? 当系统时间被调整到当前时间以前时会导致IDEA无法编辑,有3中解决方案:1)重启IDEA:( ...
- 解决iptables nat sctp协议无效的问题
环境组网如下: A----->B-----C IP如下: A:1.1.1.1 B:1.1.1.2; 2.2.2.1 C:2.2.2.2 需求为,A 需要使用sctp连通C 在B机器上添加ipta ...
- 在 Ubuntu下安装 labelImg (标数据用)
安装 SIP 下载 SIP 并解压 : $ sudo python configure.py $ make $ sudo make install 安装 依赖库 $ sudo apt-get ins ...
- nginx 超时问题: upstream timed out (110: Connection timed out) while reading response header from upstream
目录 错误内容 错误原因 错误解决办法 错误内容 我们可以在error.log 里面可以看到 错误内容:upstream timed out (110: Connection timed out) w ...
- (技术分享) 解决 Firefox 显示“已阻止载入混合活动内容”的问题
(摘自http://blog.aizhet.com/Windows/18415.html) 从 Firefox 18 开始,如果 HTTPS 页面中包含非加密的 HTTP 内容,浏览器会在控制台输出警 ...
- shellExcute 与shellExcuteex 的一些东西
最近在做外部调用exe并传给exe相应参数 方法有两种.. 1,用program.start() 2,shell() 3,调用API 以下内容来自http://www.pinvoke.net/defa ...
- VMWare开启DHCP和NAT服务(VMWare无法通过NAT上网以及和host主机通信的问题解决)
最近在学习Hadoop,开始做一个集群.由于各个节点的IP地址需要保持不变,我决定在VMWare采用NAT的模式联网. 但是在安装Ubuntu系统的时候,提示我DHCP服务未开启. Your netw ...
- Java生成xlsx格式的excel文件
xlsx格式的写入的数据量据说有百万级,结合实际需要该格式. public static void main(String[] args) throws Exception { OutputStrea ...
- 简单说说SpringMVC
距离上一次开发SpringMVC项目已经过去了大半年,有些细节已经开始遗忘,今天复习一下 先从标签说起: 和struts有各种配置文件不同,spring用标签开发. 1.@Controller在Spr ...
- POJ 2480 Longge's problem 欧拉函数—————∑gcd(i, N) 1<=i <=N
Longge's problem Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 6383 Accepted: 2043 ...
