JGProgressHUD Class Reference
+ + +Inherits from | +UIView | +
---|---|
Declared in | +JGProgressHUD.h JGProgressHUD.m |
+
Overview
+A HUD to indicate progress, success, error, warnings or other notifications to the user.
@c JGProgressHUD respects its @c layoutMargins when positioning the HUD view. Additionally, on iOS 11 if @c insetsLayoutMarginsFromSafeArea is set to @c YES (default) the @c layoutMargins additionally contain the @c safeAreaInsets.
Note: Remember to call every method from the main thread! UIKit => main thread! +@attention You may not add JGProgressHUD to a view which has an alpha value < 1.0 or to a view which is a subview of a view with an alpha value < 1.0.
Other Methods
+ +– initWithStyle:
+
+
+ Designated initializer.
+- (instancetype __nonnull)initWithStyle:(JGProgressHUDStyle)style
Parameters
+style |
+ The appearance style of the HUD. |
+
---|
Discussion
+Designated initializer.
+Declared In
+JGProgressHUD.h
+ progressHUDWithStyle:
+
+
+ Convenience initializer.
++ (instancetype __nonnull)progressHUDWithStyle:(JGProgressHUDStyle)style
Parameters
+style |
+ The appearance style of the HUD. |
+
---|
Discussion
+Convenience initializer.
+Declared In
+JGProgressHUD.h
style
+
+
+ The appearance style of the HUD. +@b Default: JGProgressHUDStyleExtraLight.
+@property (nonatomic, assign, readonly) JGProgressHUDStyle style
Discussion
+The appearance style of the HUD. +@b Default: JGProgressHUDStyleExtraLight.
+Declared In
+JGProgressHUD.h
targetView
+
+
+ The view in which the HUD is presented.
+@property (nonatomic, weak, readonly, nullable) UIView *targetView
Discussion
+The view in which the HUD is presented.
+Declared In
+JGProgressHUD.h
delegate
+
+
+ The delegate of the HUD.
+@property (nonatomic, weak, nullable) id<JGProgressHUDDelegate> delegate
Discussion
+The delegate of the HUD.
+See Also
+-
+
+
Declared In
+JGProgressHUD.h
HUDView
+
+
+ The actual HUD view visible on screen. You may add animations to this view.
+@property (nonatomic, strong, readonly, nonnull) UIView *HUDView
Discussion
+The actual HUD view visible on screen. You may add animations to this view.
+Declared In
+JGProgressHUD.h
contentView
+
+
+ The content view inside the @c HUDView. If you want to add additional views to the HUD you should add them as subview to the @c contentView.
+@property (nonatomic, strong, readonly, nonnull) UIView *contentView
Discussion
+The content view inside the @c HUDView. If you want to add additional views to the HUD you should add them as subview to the @c contentView.
+Declared In
+JGProgressHUD.h
textLabel
+
+
+ The label used to present text on the HUD. Set the @c text or @c attributedText property of this label to change the displayed text. You may not change the label’s @c frame or @c bounds.
+@property (nonatomic, strong, readonly, nonnull) UILabel *textLabel
Discussion
+The label used to present text on the HUD. Set the @c text or @c attributedText property of this label to change the displayed text. You may not change the label’s @c frame or @c bounds.
+Declared In
+JGProgressHUD.h
detailTextLabel
+
+
+ The label used to present detail text on the HUD. Set the @c text or @c attributedText property of this label to change the displayed text. You may not change the label’s @c frame or @c bounds.
+@property (nonatomic, strong, readonly, nonnull) UILabel *detailTextLabel
Discussion
+The label used to present detail text on the HUD. Set the @c text or @c attributedText property of this label to change the displayed text. You may not change the label’s @c frame or @c bounds.
+Declared In
+JGProgressHUD.h
indicatorView
+
+
+ The indicator view. You can assign a custom subclass of @c JGProgressHUDIndicatorView to this property or one of the default indicator views (if you do so, you should assign it before showing the HUD). This value is optional. +@b Default: JGProgressHUDIndeterminateIndicatorView.
+@property (nonatomic, strong, nullable) JGProgressHUDIndicatorView *indicatorView
Discussion
+The indicator view. You can assign a custom subclass of @c JGProgressHUDIndicatorView to this property or one of the default indicator views (if you do so, you should assign it before showing the HUD). This value is optional. +@b Default: JGProgressHUDIndeterminateIndicatorView.
+Declared In
+JGProgressHUD.h
shadow
+
+
+ The shadow cast by the @c HUDView. This value is optional. Setting this to @c nil means no shadow is cast by the HUD. +@b Default: nil.
+@property (nonatomic, strong, nullable) JGProgressHUDShadow *shadow
Discussion
+The shadow cast by the @c HUDView. This value is optional. Setting this to @c nil means no shadow is cast by the HUD. +@b Default: nil.
+Declared In
+JGProgressHUD.h
position
+
+
+ The position of the HUD inside the hosting view’s frame, or inside the specified frame. +@b Default: JGProgressHUDPositionCenter
+@property (nonatomic, assign) JGProgressHUDPosition position
Discussion
+The position of the HUD inside the hosting view’s frame, or inside the specified frame. +@b Default: JGProgressHUDPositionCenter
+Declared In
+JGProgressHUD.h
animation
+
+
+ The animation used for showing and dismissing the HUD. +@b Default: JGProgressHUDFadeAnimation.
+@property (nonatomic, strong, nonnull) JGProgressHUDAnimation *animation
Discussion
+The animation used for showing and dismissing the HUD. +@b Default: JGProgressHUDFadeAnimation.
+Declared In
+JGProgressHUD.h
interactionType
+
+
+ Interaction type of the HUD. Determines whether touches should be let through to the views behind the HUD.
+@property (nonatomic, assign) JGProgressHUDInteractionType interactionType
Discussion
+Interaction type of the HUD. Determines whether touches should be let through to the views behind the HUD.
+See Also
+-
+
+
JGProgressHUDInteractionType. +@b Default: JGProgressHUDInteractionTypeBlockAllTouches.
+
+
Declared In
+JGProgressHUD.h
parallaxMode
+
+
+ Parallax mode for the HUD. This setting determines whether the HUD should have a parallax (@c UIDeviceMotion) effect. This effect is controlled by device motion on iOS and remote touchpad panning gestures on tvOS.
+@property (nonatomic, assign) JGProgressHUDParallaxMode parallaxMode
Discussion
+Parallax mode for the HUD. This setting determines whether the HUD should have a parallax (@c UIDeviceMotion) effect. This effect is controlled by device motion on iOS and remote touchpad panning gestures on tvOS.
+See Also
+-
+
+
JGProgressHUDParallaxMode. +@b Default: JGProgressHUDParallaxModeDevice.
+
+
Declared In
+JGProgressHUD.h
wantsFocus
+
+
+ When this property is set to @c YES the HUD will try to become focused, which prevents interactions with the @c targetView. If set to @c NO the HUD will not become focused and interactions with @c targetView remain possible. Default: @c YES.
+@property (nonatomic, assign) BOOL wantsFocus
Discussion
+When this property is set to @c YES the HUD will try to become focused, which prevents interactions with the @c targetView. If set to @c NO the HUD will not become focused and interactions with @c targetView remain possible. Default: @c YES.
+Declared In
+JGProgressHUD.h
square
+
+
+ If the HUD should always have the same width and height. +@b Default: NO.
+@property (nonatomic, assign) BOOL square
Discussion
+If the HUD should always have the same width and height. +@b Default: NO.
+Declared In
+JGProgressHUD.h
vibrancyEnabled
+
+
+ Internally @c JGProgressHUD uses an @c UIVisualEffectView with a @c UIBlurEffect. A second @c UIVisualEffectView can be added on top of that with a @c UIVibrancyEffect which amplifies and adjusts the color of content layered behind the view, allowing content placed inside the contentView to become more vivid. This flag sets whether the @c UIVibrancyEffect should be used. Using the vibrancy effect can sometimes, depending on the contents of the display, result in a weird look (especially on iOS < 9.3). +@b Default: NO.
+@property (nonatomic, assign) BOOL vibrancyEnabled
Discussion
+Internally @c JGProgressHUD uses an @c UIVisualEffectView with a @c UIBlurEffect. A second @c UIVisualEffectView can be added on top of that with a @c UIVibrancyEffect which amplifies and adjusts the color of content layered behind the view, allowing content placed inside the contentView to become more vivid. This flag sets whether the @c UIVibrancyEffect should be used. Using the vibrancy effect can sometimes, depending on the contents of the display, result in a weird look (especially on iOS < 9.3). +@b Default: NO.
+Declared In
+JGProgressHUD.h
cornerRadius
+
+
+ The radius used for rounding the four corners of the HUD view. +@b Default: 10.0.
+@property (nonatomic, assign) CGFloat cornerRadius
Discussion
+The radius used for rounding the four corners of the HUD view. +@b Default: 10.0.
+Declared In
+JGProgressHUD.h
contentInsets
+
+
+ Insets the contents of the HUD. +@b Default: (20, 20, 20, 20).
+@property (nonatomic, assign) UIEdgeInsets contentInsets
Discussion
+Insets the contents of the HUD. +@b Default: (20, 20, 20, 20).
+Declared In
+JGProgressHUD.h
)
+
+
+ Insets the HUD from the frame of the hosting view or from the specified frame to present the HUD from. +@b Default: (20, 20, 20, 20).
+@property (nonatomic, assign) UIEdgeInsets marginInsets __attribute ( ( deprecated ( ( "Use layoutMargins instead." )
Discussion
+Insets the HUD from the frame of the hosting view or from the specified frame to present the HUD from. +@b Default: (20, 20, 20, 20).
+Declared In
+JGProgressHUD.h
visible
+
+
+ Whether the HUD is visible on screen.
+@property (nonatomic, assign, readonly, getter=isVisible) BOOL visible
Return Value
+Whether the HUD is visible on screen.
+Declared In
+JGProgressHUD.h
progress
+
+
+ The progress to display using the @c progressIndicatorView. A change of this property is not animated. Use the @c setProgress:animated: method for an animated progress change. +@b Default: 0.0.
+@property (nonatomic, assign) float progress
Discussion
+The progress to display using the @c progressIndicatorView. A change of this property is not animated. Use the @c setProgress:animated: method for an animated progress change. +@b Default: 0.0.
+Declared In
+JGProgressHUD.h
– setProgress:animated:
+
+
+ Adjusts the current progress shown by the receiver, optionally animating the change.
+- (void)setProgress:(float)progress animated:(BOOL)animated
Parameters
+progress |
+ The new progress value. |
+
---|---|
animated |
+ YES if the change should be animated, NO if the change should happen immediately. |
+
Discussion
+Adjusts the current progress shown by the receiver, optionally animating the change.
+ +The current progress is represented by a floating-point value between 0.0 and 1.0, inclusive, where 1.0 indicates the completion of the task. The default value is 0.0. Values less than 0.0 and greater than 1.0 are pinned to those limits.
+Declared In
+JGProgressHUD.h
minimumDisplayTime
+
+
+ Specifies a minimum time that the HUD will be on-screen. Useful to prevent the HUD from flashing quickly on the screen when indeterminate tasks complete more quickly than expected. +@b Default: 0.0.
+@property (nonatomic, assign) NSTimeInterval minimumDisplayTime
Discussion
+Specifies a minimum time that the HUD will be on-screen. Useful to prevent the HUD from flashing quickly on the screen when indeterminate tasks complete more quickly than expected. +@b Default: 0.0.
+Declared In
+JGProgressHUD.h
voiceOverEnabled
+
+
+ Determines whether Voice Over announcements should be made upon displaying the HUD (if Voice Over is active). +@b Default: YES
+@property (nonatomic, assign) BOOL voiceOverEnabled
Discussion
+Determines whether Voice Over announcements should be made upon displaying the HUD (if Voice Over is active). +@b Default: YES
+Declared In
+JGProgressHUD.h
tapOnHUDViewBlock
+
+
+ A block to be invoked when the HUD view is tapped.
+@property (nonatomic, copy, nullable) void ( ^ ) ( JGProgressHUD *__nonnull HUD ) tapOnHUDViewBlock
Discussion
+A block to be invoked when the HUD view is tapped.
Note: The interaction type of the HUD must be @c JGProgressHUDInteractionTypeBlockTouchesOnHUDView or @c JGProgressHUDInteractionTypeBlockAllTouches, otherwise this block won’t be fired.
Declared In
+JGProgressHUD.h
tapOutsideBlock
+
+
+ A block to be invoked when the area outside of the HUD view is tapped.
+@property (nonatomic, copy, nullable) void ( ^ ) ( JGProgressHUD *__nonnull HUD ) tapOutsideBlock
Discussion
+A block to be invoked when the area outside of the HUD view is tapped.
Note: The interaction type of the HUD must be @c JGProgressHUDInteractionTypeBlockAllTouches, otherwise this block won’t be fired.
Declared In
+JGProgressHUD.h
– showInView:
+
+
+ Shows the HUD animated. You should preferably show the HUD in a UIViewController’s view. The HUD will be repositioned in response to rotation and keyboard show/hide notifications.
+- (void)showInView:(UIView *__nonnull)view
Parameters
+view |
+ The view to show the HUD in. The frame of the @c view will be used to calculate the position of the HUD. |
+
---|
Discussion
+Shows the HUD animated. You should preferably show the HUD in a UIViewController’s view. The HUD will be repositioned in response to rotation and keyboard show/hide notifications.
+Declared In
+JGProgressHUD.h
– showInView:animated:
+
+
+ Shows the HUD. You should preferably show the HUD in a UIViewController’s view. The HUD will be repositioned in response to rotation and keyboard show/hide notifications.
+- (void)showInView:(UIView *__nonnull)view animated:(BOOL)animated
Parameters
+view |
+ The view to show the HUD in. The frame of the @c view will be used to calculate the position of the HUD. |
+
---|---|
animated |
+ If the HUD should show with an animation. |
+
Discussion
+Shows the HUD. You should preferably show the HUD in a UIViewController’s view. The HUD will be repositioned in response to rotation and keyboard show/hide notifications.
+Declared In
+JGProgressHUD.h
– dismiss
+
+
+ Dismisses the HUD animated.
+- (void)dismiss
Discussion
+Dismisses the HUD animated.
+Declared In
+JGProgressHUD.h
– dismissAnimated:
+
+
+
+– dismissAfterDelay:
+
+
+ Dismisses the HUD animated after a delay.
+- (void)dismissAfterDelay:(NSTimeInterval)delay
Parameters
+delay |
+ The delay until the HUD will be dismissed. |
+
---|
Discussion
+Dismisses the HUD animated after a delay.
+Declared In
+JGProgressHUD.h
– dismissAfterDelay:animated:
+
+
+ Dismisses the HUD after a delay.
+- (void)dismissAfterDelay:(NSTimeInterval)delay animated:(BOOL)animated
Parameters
+delay |
+ The delay until the HUD will be dismissed. |
+
---|---|
animated |
+ + |
Discussion
+Dismisses the HUD after a delay.
+Declared In
+JGProgressHUD.h
HUDManagement Methods
+ ++ allProgressHUDsInView:
+
+
+ + (NSArray<JGProgressHUD*> *__nonnull)allProgressHUDsInView:(UIView *__nonnull)view
Declared In
+JGProgressHUD.h
+ allProgressHUDsInViewHierarchy:
+
+
+ + (NSArray<JGProgressHUD*> *__nonnull)allProgressHUDsInViewHierarchy:(UIView *__nonnull)view
Declared In
+JGProgressHUD.h
Deprecated Methods
+ +– showInRect:inView:
+
+
+ Shows the HUD animated. You should preferably show the HUD in a UIViewController’s view.
+- (void)showInRect:(CGRect)rect inView:(UIView *__nonnull)view
Parameters
+rect |
+ The rect allocated in @c view for displaying the HUD. |
+
---|---|
view |
+ The view to show the HUD in. |
+
Discussion
+Shows the HUD animated. You should preferably show the HUD in a UIViewController’s view.
+Declared In
+JGProgressHUD.h
– showInRect:inView:animated:
+
+
+ Shows the HUD. You should preferably show the HUD in a UIViewController’s view.
+- (void)showInRect:(CGRect)rect inView:(UIView *__nonnull)view animated:(BOOL)animated
Parameters
+rect |
+ The rect allocated in @c view for displaying the HUD. |
+
---|---|
view |
+ The view to show the HUD in. |
+
animated |
+ If the HUD should show with an animation. |
+
Discussion
+Shows the HUD. You should preferably show the HUD in a UIViewController’s view.
+Declared In
+JGProgressHUD.h