[翻译] 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 ...
随机推荐
- Vue前端框架面试问题
1.active-class是哪个组件的属性?嵌套路由怎么定义? 答:vue-router模块的router-link组件. 2.怎么定义vue-router的动态路由?怎么获取传过来的动态参数? 答 ...
- for循环-鼠标移入事件
这里当鼠标移入触发事件时候,会报错,为什么呢?注意一下objs数组的长度是5. 因为在鼠标移入事件触发之前for循环已经将i变成5,objs[5]是不存在的,所以会报错. 可以用this来解决这种问题 ...
- dev中ASPxListBox单选和多选的设置
只需要设置SelectionMode,为Multiple时是单选,CheckColumn时是多选
- springcloud-Feign基础使用
声明式REST客户端:Feign Feign是一个声明式的Web服务客户端.它使得Web服务客户端的写入更加方便.具有可插拔注解支持,包括Feign注解和JAX-RS注解. Spring Cloud增 ...
- [Linux] Linux系统(文件操作)
linux有三种文件类型,普通文件,目录,设备文件 查看文件 使用命令ls获取ll,查看文件列表,参数:-l(列表形式),-a(展示隐藏文件) 使用元字符* ? ,查看匹配的文件列表,例如:ll a* ...
- 手把手教你写一个java的orm(二)
创建映射关系 想要实现一个orm的功能,我觉得就是要将class和数据库中的表创建映射关系.把class的名称和表的名称,class属性名称和表的字段名称,属性类型与表的字段类型一一对应起来.可以 ...
- servlet(一):从Sevlet到HttpServlet
Java Servlet 是运行在 Web 服务器或应用服务器上的程序,它是作为来自 Web 浏览器或其他 HTTP 客户端的请求和 HTTP 服务器上的数据库或应用程序之间的中间层. servlet ...
- IDEA下的第一个springBoot
1.第一步打开File->New->Project,SDK根据自己的需要选择,我这边选的是java7 2.Next之后 设置group 和artifact,根据自己的需要进行修改. 3.导 ...
- C#设计模式--命令模式(学习Learning hard C#设计模式笔记)
原文地址http://www.cnblogs.com/zhili/p/CommandPattern.html class Program { static void Main(string[] arg ...
- 浅谈常用的设计模式(new)
简单工厂模式 抽象工厂模式 代理模式 装饰者模式(Decorator):动态地给一个对象添加一些额外的职责,就增加功能来说,装饰着模式比生成子类更加灵活. 建造者模式:builder构建
