#import <MBProgressHUD.h>
Public Member Functions | |
(id) | - initWithWindow: |
A convenience constructor tat initializes the HUD with the window's bounds. | |
(void) | - showWhileExecuting:onTarget:withObject:animated: |
Shows the HUD while a background task is executing in a new thread, then hides the HUD. | |
Protected Attributes | |
SEL | methodForExecution |
id | targetForExecution |
id | objectForExecution |
bool | useAnimation |
float | width |
float | height |
UIView * | indicator |
UILabel * | label |
UILabel * | detailsLabel |
Properties | |
MBProgressHUDMode | mode |
MBProgressHUD operation mode. | |
id | delegate |
The HUD delegate object. | |
NSString * | labelText |
An optional short message to be displayed below the activity indicator. | |
NSString * | detailsLabelText |
An optional details message displayed below the labelText message. | |
float | opacity |
The opacity of the hud window. | |
UIFont * | labelFont |
Font to be used for the main label. | |
UIFont * | detailsLabelFont |
Font to be used for the details label. | |
float | progress |
The progress of the progress indicator, from 0.0 to 1.0. |
This is a simple drop-in class for displaying a progress HUD view similar to Apples 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 witch resizes depending on the user specified content. This view supports three modes of operation:
- (id) initWithWindow: | (UIWindow *) | window |
A convenience constructor tat initializes the HUD with the window's bounds.
Calls the designated constructor with window.bounds as the parameter.
- (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 NSAutoreleasePools so your method does not have to be concerned with setting up a pool.
method | The method to be executed while the HUD is shown. This method will be executed in a new thread. | |
target | The object that the target method belongs to. | |
object | An optional object to be passed to the method. | |
animated | If set to YES the HUD will appear and disappear using a fade animation. If set to NO the HUD will not use animations while appearing and disappearing. |
- (id) delegate [read, write, assign] |
The HUD delegate object.
If set the delegate will receive hudWasHidden callbacks when the hud was hidden. The delegate should conform to the MBProgressHUDDelegate protocol and implement the hudWasHidden method. The delegate object will not be retained.
- (UIFont *) detailsLabelFont [read, write, retain] |
Font to be used for the details label.
Set this property if the default is not adequate.
- (NSString *) detailsLabelText [read, write, copy] |
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 (@"").
- (UIFont *) labelFont [read, write, retain] |
Font to be used for the main label.
Set this property if the default is not adequate.
- (NSString *) labelText [read, write, copy] |
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.
- (MBProgressHUDMode) mode [read, write, assign] |
MBProgressHUD operation mode.
Switches between indeterminate (MBProgressHUDModeIndeterminate) and determinate progress (MBProgressHUDModeDeterminate). The default is MBProgressHUDModeIndeterminate.
- (float) opacity [read, write, assign] |
The opacity of the hud window.
Defaults to 0.9 (90% opacity).
- (float) progress [read, write, assign] |
The progress of the progress indicator, from 0.0 to 1.0.
Defaults to 0.0.