ITProgressIndicator 0.1

ITProgressIndicator 0.1

测试已测试
Lang语言 Obj-CObjective C
许可证 自定义
发布最后发布2015年2月

Dongyuan Liu 维护。



NSProgressIndicator 提供核心动画驱动的替换类。它高度可定制,比 NSProgressIndicator 更有效率。

ITProgressInidicator 是为了 Play by Play 而创建的,此项目由 David Keegan 资助。

使用方法

复制文件

复制以下文件

  • ITProgressIndicator.h
  • ITProgressIndicator.m

请确保将它们复制到项目中,并将它们添加到目标中。

在项目中使用

请确保检查示例项目。只需将自定义视图拖到您的窗口上,并将它的自定义类设置为 ITProgressIndicator

建议将您的进度指示器嵌入到层支持的视图中!查看示例应用程序以获取说明。

要自定义您的进度指示器,请使用以下属性

/// @property isIndeterminate - Indicates if the view will show the progress, or just spin
@property (nonatomic, setter = setIndeterminate:) BOOL isIndeterminate;

/// @property progress - The amount that should be shown when `isIndeterminate` is set to `YES`
@property (nonatomic) CGFloat progress;

/// @property animates - Indicates if the view is animating
@property (nonatomic) BOOL animates;

/// @property hideWhenStopped - Indicates if the view will be hidden if it's stopped
@property (nonatomic) BOOL hideWhenStopped;

/// @property lengthOfLine - The length of a single line
@property (nonatomic) CGFloat lengthOfLine;

/// @property widthOfLine - The width of a single line
@property (nonatomic) CGFloat widthOfLine;

/// @property numberOfLines - The number of lines of the indicator
@property (nonatomic) NSUInteger numberOfLines;

/// @property innerMargin - The distance of the lines from the middle
@property (nonatomic) CGFloat innerMargin;

/// @property animationDuration - Duration of a single rotation
@property (nonatomic) CGFloat animationDuration;

/// @property gradualAnimation - Defines if the animation is smooth or gradual
@property (nonatomic) BOOL steppedAnimation;

/// @property color - The color of the progress indicator
@property (nonatomic, strong) NSColor *color;

您还可以覆盖以下方法以实现自己的自定义动画

/**
 *  Override this method to achieve a custom animation
 *
 *  @return CAKeyframeAnimation - animation which will be put on the progress indicator layer
 */
- (CAKeyframeAnimation *)keyFrameAnimationForCurrentPreferences;