EAColourfulProgressView 是一个自定义进度视图,其当前填充颜色根据当前值在两种颜色之间生成。
它利用了 IBDesignable
和 IBInspectable
,因此您可以在不离开 Interface Builder 的情况下完全自定义。
您可以通过调用以下方法来更新当前值
/**
* 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;
在 Interface Builder 中将 UIView
的 Custom Class
设置为 EAColourfulProgressView
,自定义可用变量并观看它们实时渲染;)