一个包含多种选项的迷人视图。它旨在与 BFRadialWaveHUD 一起使用,但你可以自由使用它 :)
BFRadialWaveView 是 UIView 的子类。它显示带有各种选项的径向波。它被制作成 BFRadialWaveHUD 的进度/旋转视图。
请参阅此 CHANGELOG.md。
BFRadialWaveViewMode_Default // Default: A swirly looking thing.
BFRadialWaveViewMode_KuneKune // Kune Kune: A creepy feeler looking thing.
BFRadialWaveViewMode_North // North: Points upwards.
BFRadialWaveViewMode_NorthEast // North East: Points upwards to the right.
BFRadialWaveViewMode_East // East: Points right.
BFRadialWaveViewMode_SouthEast // South East: Points downwards to the right.
BFRadialWaveViewMode_South // South: Points down.
BFRadialWaveViewMode_SouthWest // South West: Points downwards to the left.
BFRadialWaveViewMode_West // West: Points left.
BFRadialWaveViewMode_NorthWest // North West: Points at Kanye.
在代码中制作 BFRadialWaveView 时使用此方法。
/** * Custom initializer. Use this when you make a BFRadialWaveView in code. * * @param container A UIView to place this one in. * @param numberOfCircles NSInteger number of circles. Min = 3, Max = 20. * @param circleColor UIColor to set the circles' strokeColor to. * @param mode BFRadialWaveViewMode. * @param strokeWidth CGFloat stroke width of the circles. * @param withGradient BOOL flag to decide whether or not to draw a gradient in the background. * * @return Returns A BFRadialWaveView! Aww yiss! */ - (instancetype)initWithView:(UIView *)container circles:(NSInteger)numberOfCircles color:(UIColor *)circleColor mode:(BFRadialWaveViewMode)mode strokeWidth:(CGFloat)strokeWidth withGradient:(BOOL)withGradient;
在故事板或 xib 中制作 BFRadialWaveView 时使用此方法。
/** * Setup. Use this when you made a BFRadialWaveView in the storyboard or xib. * * @param container A UIView to place this one in. * @param numberOfCircles NSInteger number of circles. Min = 3, Max = 20. * @param circleColor UIColor to set the circles' strokeColor to. * @param mode BFRadialWaveViewMode. * @param strokeWidth CGFloat stroke width of the circles. * @param withGradient BOOL flag to decide whether or not to draw a gradient in the background. */ - (void)setupWithView:(UIView *)container circles:(NSInteger)numberOfCircles color:(UIColor *)circleColor mode:(BFRadialWaveViewMode)mode strokeWidth:(CGFloat)strokeWidth withGradient:(BOOL)withGradient;
/** Show a basic view with no progress. */
- (void)show;
/**
* Show a view with progress.
*
* @param progress CGFloat between 0.f and 1.f. The progress to show.
*/
- (void)showProgress:(CGFloat)progress;
/** Show a success view. */
- (void)showSuccess;
/** Show an error view. */
- (void)showError;
/**
* Update the progress to a certain value.
*
* @param progress CGFloat between 0.f and 1.f. The progress to show.
*/
- (void)updateProgress:(CGFloat)progress;
/**
* Update the circle color on the fly.
*
* @param color UIColor to set the circles' strokeColor to.
*/
- (void)updateCircleColor:(UIColor *)color;
暂停和继续功能由 GitHub 用户 @fco-edno 丰厚地增添 :)
/** Pause the animation. */
- (void)pauseAnimation;
/** Resume the animation. */
- (void)resumeAnimation;
/**
* Check the paused/not-paused state of the view's animations.
*
* @return Returns a BOOL flag indicating the state of the animation being either paused (YES) or not-paused (NO).
*/
- (BOOL)isPaused;
/**
* Activate of Deactivate disco mode! This will rapidly cycle colors through your BFRadialWaveView. Without setting the colors explicitly, a rainbow is used.
*
* @param on BOOL flag to turn disco mode on (YES) or off (NO).
*/
- (void)disco:(BOOL)on;
/** The diameter of the view (including progress circle). */
@property (nonatomic, readonly) CGFloat diameter;
/** The UIColor to set the progress circle to. Default is the same as the circleColor passed into the initializer or the setup. */
@property (nonatomic) UIColor *progressCircleColor;
/** The UIColor to set the success checkmark to. By default it is the same as the circleColor passed into the initializer or the setup. */
@property (nonatomic) UIColor *checkmarkColor;
/** The UIColor to set the failure cross to. By default it is the same as the circleColor passed into the initializer or the setup. */
@property (nonatomic) UIColor *crossColor;
/** An NSArray of colors to use for disco mode. By default it is the rainbow. */
@property (nonatomic) NSArray *discoColors;
/** CGFloat speed for the disco animation. Default is 0.33f. */
@property (nonatomic) CGFloat discoSpeed;
/** BFRadialWaveViewDelegate delegate for our protocol. */
@property id <BFRadialWaveViewDelegate> delegate;
请务必查看包含的示例应用程序,了解如何使用 BFRadialWaveView 的示例。
将BFRadialWaveView头文件和实现文件(BFRadialWaveView.h & BFRadialWaveView.m)以及BFGradientCALayer头文件和实现文件(BFGradientLayer.h & BFGradientLayer.m)添加到您的项目中。
BFRadialWaveView *radialWaveView;
radialWaveView = [[BFRadialWaveView alloc] initWithView:self.view
circles:BFRadialWaveView_DefaultNumberOfCircles
color:nil
mode:BFRadialWaveViewMode_Default
strokeWidth:BFRadialWaveView_DefaultStrokeWidth
withGradient:YES];
[radialWaveView show];
BFRadialWaveView *radialWaveView;
radialWaveView = [[BFRadialWaveView alloc] initWithView:self.view
circles:10
color:[UIColor darkGray]
mode:BFRadialWaveViewMode_North
strokeWidth:5.f
withGradient:NO];
[radialWaveView disco:YES]; // Disco time!
[radialWaveView showProgress:someProgressBetweenZeroAndOne];
BFRadialWaveView使用了MIT许可证
请参阅包含的LICENSE文件。