BFRadialWaveHUD 2.0.0

BFRadialWaveHUD 2.0.0

测试已测试
语言语言 Obj-CObjective C
许可证 MIT
发布最新发布2016年12月

Bence Feher维护。



  • Bence Feher

这是一个使用BFRadialWaveView的进度HUD。向使用MIT许可使他的惊人的KVNProgress HUD可用的github用户@kevin-hirsch表示巨大感谢!实际HUD代码的大部分,以及所有图像处理代码都来自该项目。再次感谢!

点击下面的截图以查看动画gifv!
Animated Screenshot

关于

BFRadialWaveHUD是一个完全可定制的进度HUD,支持全屏、背景模糊、动态更改消息文本和迪斯科时间。BFRadialWaveViewHUD的目的是让用户着迷并催眠他们忘记正在等待加载某个内容。认真地说,只需盯着它一段时间即可。同时向催眠蛙表示敬意。
BFRadialWaveHUD使用BFRadialWaveView

变更

请参阅此CHANGELOG.md

待办事项

  • 在应用唤醒时重新启动动画。(注意,这是要修复BFRadialWaveView的问题)
  • 将资源移动到资源目录中,反映在cocoapod中的此更改。(修复文件结构)

模式

BFRadialWaveHUDMode_Default       // Default: A swirly looking thing.
BFRadialWaveHUDMode_KuneKune      // Kune Kune: A creepy feeler looking thing.
BFRadialWaveHUDMode_North         // North: Points upwards.
BFRadialWaveHUDMode_NorthEast     // North East: Points upwards to the right.
BFRadialWaveHUDMode_East          // East: Points right.
BFRadialWaveHUDMode_SouthEast     // South East: Points downwards to the right.
BFRadialWaveHUDMode_South         // South: Points down.
BFRadialWaveHUDMode_SouthWest     // South West: Points downwards to the left.
BFRadialWaveHUDMode_West          // West: Points left.
BFRadialWaveHUDMode_NorthWest     // North West: Points at Kanye.

方法

初始化器

在代码中创建BFRadialWaveHUD时使用此方法。

/**
 *  Custom initializer. Use this when you make a BFRadialWaveHUD in code.
 *
 *  @param fullscreen      BOOL flag to display in fullscreen or not.
 *  @param numberOfCircles NSInteger number of circles. Min = 3, Max = 20.
 *  @param circleColor     UIColor to set the circles' strokeColor to.
 *  @param mode            BFRadialWaveHUDMode
 *  @param strokeWidth     CGFloat stroke width of the circles.
 *
 *  @return Returns a BFRadialWaveHUD! Aww yiss!
 */
- (instancetype)initWithFullScreen:(BOOL)fullscreen
                           circles:(NSInteger)numberOfCircles
                       circleColor:(UIColor *)circleColor
                              mode:(BFRadialWaveHUDMode)mode
                       strokeWidth:(CGFloat)strokeWidth;

加载

/**
 *  Show an indeterminate HUD.
 *
 *  @param containerView   The UIView to place the HUD in.
 */
- (void)showInView:(UIView *)containerView;
/**
 *  Show an indeterminate HUD with a message.
 *
 *  @param message          NSString message to display below the spinning BFRadialWaveView.
 *  @param containerView    The UIView to place the HUD in.
 */
- (void)showWithMessage:(NSString *)message
                 inView:(UIView *)containerView;

进度

/**
 *  Show a BFRadialWaveHUD with an extra circle for progress.
 *
 *  @param progress         CGFloat progress (range [0.f, 1.f]) to show.
 *  @param containerView    The UIView to place the HUD in.
 */
- (void)showWithProgress:(CGFloat)progress
                  inView:(UIView *)containerView;
/**
 *  Show a BFRadialWaveHUD with an extra circle for progress with a message.
 *
 *  @param progress         CGFloat progress (range [0.f, 1.f]) to show.
 *  @param message          NSString message to display below the spinning BFRadialWaveView.
 *  @param containerView    The UIView to place the HUD in.
 */
- (void)showWithProgress:(CGFloat)progress
             withMessage:(NSString *)message
                  inView:(UIView *)containerView;

成功

/**
 *  Show a success checkmark, indicating success.
 *
 *  @param containerView    The UIView to place the HUD in.
 */
- (void)showSuccessInView:(UIView *)containerView;
/**
 *  Show a success checkmark and run a block of code after it completes.
 *
 *  @param containerView    The UIView to place the HUD in.
 *  @param completionBlock  A block of code to run on completion.
 */
- (void)showSuccessInView:(UIView *)containerView
           withCompletion:(void (^)(BOOL finished))completionBlock;
/**
 *  Show a success checkmark with a message.
 *
 *  @param message          NSString message to display below the spinning BFRadialWaveView.
 *  @param containerView    The UIView to place the HUD in.
 */
- (void)showSuccessWithMessage:(NSString *)message
                        inView:(UIView *)containerView;
/**
 *  Show a success checkmark with a message and run a block of code after it completes.
 *
 *  @param message          NSString message to display below the spinning BFRadialWaveView.
 *  @param containerView    The UIView to place the HUD in.
 *  @param completionBlock  A block of code to run on completion.
 */
- (void)showSuccessWithMessage:(NSString *)message
                        inView:(UIView *)containerView
                    completion:(void (^)(BOOL finished))completionBlock;

错误

/**
 *  Show an error 'X', indicating failure/error.
 *
 *  @param containerView    The UIView to place the HUD in.
 */
- (void)showErrorInView:(UIView *)containerView;
/**
 *  Show an error 'X' and run a block of code after it completes.
 *
 *  @param containerView    The UIView to place the HUD in.
 *  @param completionBlock  A block of code to run on completion.
 */
- (void)showErrorInView:(UIView *)containerView
         withCompletion:(void (^)(BOOL finished))completionBlock;
/**
 *  Show an error 'X' with a message.
 *
 *  @param message          NSString message to display below the spinning BFRadialWaveView.
 *  @param containerView    The UIView to place the HUD in.
 */
- (void)showErrorWithMessage:(NSString *)message
                      inView:(UIView *)containerView;
/**
 *  Show an error 'X' with a message and run a block of code after it completes.
 *
 *  @param message          NSString message to display below the spinning BFRadialWaveView.
 *  @param containerView    The UIView to place the HUD in.
 *  @param completionBlock  A block of code to run on completion.
 */
- (void)showErrorWithMessage:(NSString *)message
                      inView:(UIView *)containerView
                  completion:(void (^)(BOOL finished))completionBlock;

消失

/**
 *  Dimiss a BFRadialWaveHUD.
 */
- (void)dismiss;
/**
 *  Dimiss a BFRadialWaveHUD and run a block of code after it completes.
 *
 *  @param completionBlock A block of code to run on completion.
 */
- (void)dismissWithCompletion:(void (^)(BOOL finished))completionBlock;
/**
 *  Dimiss a BFRadialWaveHUD after a delay has passed.
 *
 *  @param delayInSeconds CGFloat of seconds to delay before fading away.
 */
- (void)dismissAfterDelay:(CGFloat)delayInSeconds;
/**
 *  Dismiss a BFRadialWaveHUD after a delay has passed and run a block of code after it completes.
 *
 *  @param delayInSeconds CGFloat of seconds to delay before fading away.
 *  @param completionBlock A block of code to run on completion.
 */
- (void)dismissAfterDelay:(CGFloat)delayInSeconds
           withCompletion:(void (^)(BOOL finished))completionBlock;

更新

/**
 *  Update the message written below the BFRadialWaveView spinner.
 *
 *  @param message NSString message to display.
 */
- (void)updateMessage:(NSString *)message;
/**
 *  Update the progress to display.
 *
 *  @param progress CGFloat progress (range [0.f, 1.f]) to display.
 */
- (void)updateProgress:(CGFloat)progress;

暂停和恢复

/** Pause the animation. */
- (void)pause;

/** Resume the animation. */
- (void)resume;

娱乐

/**
 *  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;

属性

消息

/** UIFont for the message label below the BFRadialWaveView spinner. */
@property (nonatomic) UIFont *messageFont;
/** UIColor for the textColor of the message label below the BFRadialWaveView spinner. */
@property (nonatomic) UIColor *messageColor;

HUD

/** UIColor for the HUD. This is also the color used when in fullscreen. Colors with high alpha values are recommended to help block out the content behind the HUD. */
@property (nonatomic) UIColor *HUDColor;
/** UIColor for the background of non-fullscreen HUDs. Colors with high alpha values are recommended to help block out the content behind the HUD. */
@property (nonatomic) UIColor *backgroundFadeColor;
/** 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 color 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 color 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;

行为

/** BOOL flag to set whether to dismiss on tap (YES) or ignore taps (NO). */
@property (nonatomic) BOOL tapToDismiss;
/** Block to run after dismissal via tap. */
@property (nonatomic, copy) void (^tapToDismissCompletionBlock)(BOOL finished);
/** A READONLY BOOL flag for your convenience. Returns YES when the HUD is showing, and NO when it is not. */
@property (readonly) BOOL isShowing;
/** BOOL flag to set whether to blur the background (YES) or not (NO). */
@property (nonatomic) BOOL blurBackground;

狂欢

/** 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;

用途

请确保查看附带演示应用程序以查看如何使用BFRadialWaveHUD的示例。将《类别》、《类》和《资源》三个目录的内容手动添加到您的项目或通过cocoapods添加。

工作示例

// Create a HUD with default number of circles, default color, default mode, and default circle stroke width:
BFRadialWaveHUD *hud = [[BFRadialWaveHUD alloc] initWithFullScreen:NO
                                                           circles:BFRadialWaveHUD_DefaultNumberOfCircles
                                                       circleColor:nil
                                                              mode:BFRadialWaveHUDMode_Default
                                                       strokeWidth:BFRadialWaveHUD_DefaultCircleStrokeWidth];
[hud show];

定制示例

// Create a very customized HUD:
BFRadialWaveHUD *hud = [[BFRadialWaveHUD alloc] initWithFullScreen:YES
                                                           circles:10
                                                       circleColor:[UIColor whiteColor]
                                                              mode:BFRadialWaveHUDMode_South
                                                       strokeWidth:4.f];
hud.blurBackground = YES; // default is NO
hud.tapToDismiss = YES; // default is NO
hud.progressCircleColor = [UIColor paperColorLightBlue];
hud.checkmarkColor = [UIColor paperColorGreen];
hud.crossColor = [UIColor paperColorRed];
hud.HUDColor = [UIColor colorWithWhite:1.f alpha:0.85f];
hud.backgroundFadeColor = [UIColor colorWithWhite:0.13f alpha:0.6f];
NSArray *discoColors = @[[UIColor paperColorIndigoA100],
                             [UIColor paperColorIndigoA200],
                             [UIColor paperColorIndigoA400],
                             [UIColor paperColorIndigoA700]];
[hud setDiscoColors:discoColors];
[hud showProgress:0.f withMessage:@"Downloading..."];

许可证

BFRadialWaveHUD 使用MIT许可证

请参阅附带LICENSE文件