[翻译] EAColourfulProgressView

EAColourfulProgressView

效果:

EAColourfulProgressView is a custom progress view where the current filling colour is generated between two colours, based on the current value.

It takes advantages of IBDesignable and IBInspectable so that you can completely customize with without leaving the Interface Builder:

EAColourfulProgressView是一个定制的进度条view,其进度当中的颜色介于两个颜色之间,当前颜色值由当前值决定。

它使用了IBDesignable与IBInspectable,所以,你可以完全的定制他,不用IB也行:

It gives you the possibility to update the current value by calling:

你可以使用如下的方法来实时更新颜色值:

/**
 *  This method updates the current value to the given one. It can
 *  animate the progress view filling size, as well as the background
 *  color change, if 'animated' is YES.
 *
 *  @param currentValue The new current value to be used.
 *  @param animated BOOL with YES if the update should be animated, NO otherwise.
 */
- (void)updateToCurrentValue:(NSInteger)currentValue animated:(BOOL)animated;

Installation Cocoapods

Add this in your Podfile

pod 'EAColourfulProgressView', '~> 0.1.0'

Usage

Set the Custom Class of a UIView to EAColourfulProgressView in Interface Builder, customize the available variables and see them being live rendered ;)

在IB中,你将UIVIew的子类设置成EAColourfulProgressView,定制一下属性,然后就会像上图中显示的那样子了:)

Future improvements

  • Any number of segments 任意数量的分段显示
  • Segment separators (loading like progress view) 分段显示风格(看起来像真正的进度条)
  • Performance improvements 改进
原文地址:https://www.cnblogs.com/YouXianMing/p/4109828.html