Bored Room Bingo
 All Classes Functions Properties
Instance Methods | Class Methods | Properties | List of all members
MBProgressHUD Class Reference

#import <MBProgressHUD.h>

Inheritance diagram for MBProgressHUD:

Instance Methods

(id) - initWithWindow:
 
(id) - initWithView:
 
(void) - show:
 
(void) - hide:
 
(void) - hide:afterDelay:
 
(void) - showWhileExecuting:onTarget:withObject:animated:
 

Class Methods

(MB_INSTANCETYPE) + showHUDAddedTo:animated:
 
(BOOL) + hideHUDForView:animated:
 
(NSUInteger) + hideAllHUDsForView:animated:
 
(MB_INSTANCETYPE) + HUDForView:
 
(NSArray *) + allHUDsForView:
 

Properties

MBProgressHUDMode mode
 
MBProgressHUDAnimation animationType
 
UIView * customView
 
id< MBProgressHUDDelegatedelegate
 
NSString * labelText
 
NSString * detailsLabelText
 
float opacity
 
UIColor * color
 
float xOffset
 
float yOffset
 
float margin
 
float cornerRadius
 
BOOL dimBackground
 
float graceTime
 
float minShowTime
 
BOOL taskInProgress
 
BOOL removeFromSuperViewOnHide
 
UIFont * labelFont
 
UIColor * labelColor
 
UIFont * detailsLabelFont
 
UIColor * detailsLabelColor
 
UIColor * activityIndicatorColor
 
float progress
 
CGSize minSize
 
CGSize size
 
BOOL square
 

Detailed Description

Displays a simple HUD window containing a progress indicator and two optional labels for short messages.

This is a simple drop-in class for displaying a progress HUD view similar to Apple's private UIProgressHUD class. The MBProgressHUD window spans over the entire space given to it by the initWithFrame constructor and catches all user input on this region, thereby preventing the user operations on components below the view. The HUD itself is drawn centered as a rounded semi-transparent view which resizes depending on the user specified content.

This view supports four modes of operation:

Method Documentation

+ (NSArray *) allHUDsForView: (UIView *)  view

Finds all HUD subviews and returns them.

Parameters
viewThe view that is going to be searched.
Returns
All found HUD views (array of MBProgressHUD objects).
- (void) hide: (BOOL)  animated

Hide the HUD. This still calls the hudWasHidden: delegate. This is the counterpart of the show: method. Use it to hide the HUD when your task completes.

Parameters
animatedIf set to YES the HUD will disappear using the current animationType. If set to NO the HUD will not use animations while disappearing.
See also
animationType
- (void) hide: (BOOL)  animated
afterDelay: (NSTimeInterval)  delay 

Hide the HUD after a delay. This still calls the hudWasHidden: delegate. This is the counterpart of the show: method. Use it to hide the HUD when your task completes.

Parameters
animatedIf set to YES the HUD will disappear using the current animationType. If set to NO the HUD will not use animations while disappearing.
delayDelay in seconds until the HUD is hidden.
See also
animationType
+ (NSUInteger) hideAllHUDsForView: (UIView *)  view
animated: (BOOL)  animated 

Finds all the HUD subviews and hides them.

Parameters
viewThe view that is going to be searched for HUD subviews.
animatedIf set to YES the HUDs will disappear using the current animationType. If set to NO the HUDs will not use animations while disappearing.
Returns
the number of HUDs found and removed.
See also
+ hideHUDForView:animated:
animationType
+ (BOOL) hideHUDForView: (UIView *)  view
animated: (BOOL)  animated 

Finds the top-most HUD subview and hides it. The counterpart to this method is showHUDAddedTo:animated:.

Parameters
viewThe view that is going to be searched for a HUD subview.
animatedIf set to YES the HUD will disappear using the current animationType. If set to NO the HUD will not use animations while disappearing.
Returns
YES if a HUD was found and removed, NO otherwise.
See also
+ showHUDAddedTo:animated:
animationType
+ (MB_INSTANCETYPE) HUDForView: (UIView *)  view

Finds the top-most HUD subview and returns it.

Parameters
viewThe view that is going to be searched.
Returns
A reference to the last HUD subview discovered.
- (id) initWithView: (UIView *)  view

A convenience constructor that initializes the HUD with the view's bounds. Calls the designated constructor with view.bounds as the parameter

Parameters
viewThe view instance that will provide the bounds for the HUD. Should be the same instance as the HUD's superview (i.e., the view that the HUD will be added to).
- (id) initWithWindow: (UIWindow *)  window

A convenience constructor that initializes the HUD with the window's bounds. Calls the designated constructor with window.bounds as the parameter.

Parameters
windowThe window instance that will provide the bounds for the HUD. Should be the same instance as the HUD's superview (i.e., the window that the HUD will be added to).
- (void) show: (BOOL)  animated

Display the HUD. You need to make sure that the main thread completes its run loop soon after this method call so the user interface can be updated. Call this method when your task is already set-up to be executed in a new thread (e.g., when using something like NSOperation or calling an asynchronous call like NSURLRequest).

Parameters
animatedIf set to YES the HUD will appear using the current animationType. If set to NO the HUD will not use animations while appearing.
See also
animationType
+ (MB_INSTANCETYPE) showHUDAddedTo: (UIView *)  view
animated: (BOOL)  animated 

Creates a new HUD, adds it to provided view and shows it. The counterpart to this method is hideHUDForView:animated:.

Parameters
viewThe view that the HUD will be added to
animatedIf set to YES the HUD will appear using the current animationType. If set to NO the HUD will not use animations while appearing.
Returns
A reference to the created HUD.
See also
+ hideHUDForView:animated:
animationType
- (void) showWhileExecuting: (SEL)  method
onTarget: (id)  target
withObject: (id)  object
animated: (BOOL)  animated 

Shows the HUD while a background task is executing in a new thread, then hides the HUD.

This method also takes care of autorelease pools so your method does not have to be concerned with setting up a pool.

Parameters
methodThe method to be executed while the HUD is shown. This method will be executed in a new thread.
targetThe object that the target method belongs to.
objectAn optional object to be passed to the method.
animatedIf set to YES the HUD will (dis)appear using the current animationType. If set to NO the HUD will not use animations while (dis)appearing.

Property Documentation

- (UIColor*) activityIndicatorColor
readwriteatomicassign

The color of the activity indicator. Defaults to [UIColor whiteColor] Does nothing on pre iOS 5.

- (MBProgressHUDAnimation) animationType
readwriteatomicassign

The animation type that should be used when the HUD is shown and hidden.

See also
MBProgressHUDAnimation
- (UIColor*) color
readwriteatomicassign

The color of the HUD window. Defaults to black. If this property is set, color is set using this UIColor and the opacity property is not used. using retain because performing copy on UIColor base colors (like [UIColor greenColor]) cause problems with the copyZone.

- (float) cornerRadius
readwriteatomicassign

The corner radius for the HUD Defaults to 10.0

- (UIView*) customView
readwriteatomicassign

The UIView (e.g., a UIImageView) to be shown when the HUD is in MBProgressHUDModeCustomView. For best results use a 37 by 37 pixel view (so the bounds match the built in indicator bounds).

- (id<MBProgressHUDDelegate>) delegate
readwriteatomicassign

The HUD delegate object.

See also
MBProgressHUDDelegate
- (UIColor*) detailsLabelColor
readwriteatomicassign

Color to be used for the details label. Set this property if the default is not adequate.

- (UIFont*) detailsLabelFont
readwriteatomicassign

Font to be used for the details label. Set this property if the default is not adequate.

- (NSString*) detailsLabelText
readwriteatomiccopy

An optional details message displayed below the labelText message. This message is displayed only if the labelText property is also set and is different from an empty string (""). The details text can span multiple lines.

- (BOOL) dimBackground
readwriteatomicassign

Cover the HUD background view with a radial gradient.

- (UIColor*) labelColor
readwriteatomicassign

Color to be used for the main label. Set this property if the default is not adequate.

- (UIFont*) labelFont
readwriteatomicassign

Font to be used for the main label. Set this property if the default is not adequate.

- (NSString*) labelText
readwriteatomiccopy

An optional short message to be displayed below the activity indicator. The HUD is automatically resized to fit the entire text. If the text is too long it will get clipped by displaying "..." at the end. If left unchanged or set to "", then no message is displayed.

- (float) margin
readwriteatomicassign

The amount of space between the HUD edge and the HUD elements (labels, indicators or custom views). Defaults to 20.0

- (float) minShowTime
readwriteatomicassign

The minimum time (in seconds) that the HUD is shown. This avoids the problem of the HUD being shown and than instantly hidden. Defaults to 0 (no minimum show time).

- (CGSize) minSize
readwriteatomicassign

The minimum size of the HUD bezel. Defaults to CGSizeZero (no minimum size).

- (MBProgressHUDMode) mode
readwriteatomicassign

MBProgressHUD operation mode. The default is MBProgressHUDModeIndeterminate.

See also
MBProgressHUDMode
- (float) opacity
readwriteatomicassign

The opacity of the HUD window. Defaults to 0.8 (80% opacity).

- (float) progress
readwriteatomicassign

The progress of the progress indicator, from 0.0 to 1.0. Defaults to 0.0.

- (BOOL) removeFromSuperViewOnHide
readwriteatomicassign

Removes the HUD from its parent view when hidden. Defaults to NO.

- (CGSize) size
readatomicassign

The actual size of the HUD bezel. You can use this to limit touch handling on the bezel aria only.

See also
https://github.com/jdg/MBProgressHUD/pull/200
- (BOOL) square
readwriteatomicassign

Force the HUD dimensions to be equal if possible.

- (BOOL) taskInProgress
readwriteatomicassign

Indicates that the executed operation is in progress. Needed for correct graceTime operation. If you don't set a graceTime (different than 0.0) this does nothing. This property is automatically set when using showWhileExecuting:onTarget:withObject:animated:. When threading is done outside of the HUD (i.e., when the show: and hide: methods are used directly), you need to set this property when your task starts and completes in order to have normal graceTime functionality.

- (float) xOffset
readwriteatomicassign

The x-axis offset of the HUD relative to the centre of the superview.

- (float) yOffset
readwriteatomicassign

The y-axis offset of the HUD relative to the centre of the superview.


The documentation for this class was generated from the following files: