Mode 1. Show directly on view
HUD = [[Mbprogresshud ShowHUDAddedTo:self.view Animated:yes] retain];
Hud.delegate = self;
Common settings
Background color of small rectangle
Hud.color = [Uicolor clearcolor];//here means no background
Text to display
Hud.labeltext = @ "Test";
Detail text
Hud.detailslabeltext = @ "Test detail";
Is there a Shu hood?
Hud.dimbackground = YES;
[HUD Hide:yes Afterdelay:2];
//Display text only
Mbprogresshud *hud = [Mbprogresshud showHUDAddedTo:self.view animated:yes];
hud.mode = Mbprogresshudmodetext;
Hud.labeltext = @ "Some message ...";
hud.margin = 10.f;
hud.yoffset = 150.f;
hud.removefromsuperviewonhide = YES;
[HUD Hide:yes afterdelay:3];
Mode 2.initWithView
Use block
HUD = [[Mbprogresshud alloc] initWithView:self.view];
[Self.view Addsubview:hud];
Hud.labeltext = @ "Test";
[HUD Showanimated:yes whileexecutingblock:^{
NSLog (@ "%@", @ "do somethings ...");
[Self dotask];
} completionblock:^{
[HUD Removefromsuperview];
[HUD release];
}];
Round progress bar
HUD = [[Mbprogresshud alloc] initWithView:self.view];
[Self.view Addsubview:hud];
Hud.mode = mbprogresshudmodeannulardeterminate;
Hud.delegate = self;
Hud.labeltext = @ "Loading";
[HUD showwhileexecuting: @selector (myprogresstask) ontarget:self Withobject:nil Animated:yes];
Custom View
HUD = [[Mbprogresshud alloc] initWithView:self.view];
Hud.customview = [[[Uiimageview alloc] initwithimage:[uiimage imagenamed:@ "37x-checkmark.png"]] autorelease];
Set Custom View mode
Hud.mode = Mbprogresshudmodecustomview;
Hud.delegate = self;
Hud.labeltext = @ "Completed";
[HUD Show:yes];
[HUD Hide:yes Afterdelay:3];
Proxy method:
[CPP] View plaincopy
#pragma mark-
#pragma the agent method of the Mark HUD, which executes when the HUD is turned off
-(void) Hudwashidden: (Mbprogresshud *) HUD
{
[HUD Removefromsuperview];
[HUD release];
HUD = nil;
}
Basic use of Mbprogresshud