[翻译] ValueTrackingSlider
2014-04-04 20:12
369 查看
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 valueCustomizable 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 addpod '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 ASValueTrackingSliderin 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
- Online Object Tracking: A Benchmark 翻译
- 【翻译】VC10中的C++0x新特性:右值引用(rvalue references) (2)
- (翻译)第二十一回 JavaFX2.0 滑动条Slider
- Survey of single-target visual tracking methods based on online learning 翻译
- [翻译] Effective C++, 3rd Edition, Item 20: 用 pass-by-reference-to-const(传 const 引用)取代 pass-by-value(传值)(下)
- 【翻译】VC10中的C++0x新特性:右值引用(rvalue references) (1)
- 【翻译】VC10中的C++0x新特性:右值引用(rvalue references) (3)
- Unity2017.1官方UGUI文档翻译——Slider
- Learning a Deep Compact Image Representation for Visual Tracking的部分翻译和个人理解
- processing-GUI:G4P library-GSlider2D (滑动器):setLimitsX(),setLimitsY(),getValueXI().getValueYI()
- [翻译] Effective C++, 3rd Edition, Item 37: 绝不要重定义一个函数的 inherited default parameter value(通过继承得到的缺省参数值)
- easyui源码翻译1.32--Slider(滑动条)
- Hierarchical Convolutional Features for Visual Tracking(CF2)论文翻译
- Online Object Tracking : A Benchmark 翻译
- KVO编程指南,Key-Value Observing Programming Guide翻译 - iOS
- Video Tracking Theory and Practice 关键翻译1
- 目标追踪——相关滤波追踪论文翻译:Visual Object Tracking using Adaptive Correlation Filters
- Online Object Tracking: A Benchmark 翻译
- [翻译] TWRPickerSlider