//Way 1. Show directly on view
HUD = [[Mbprogresshud ShowHUDAddedTo:self.view Animated:yes] retain];
Hud.delegate = self;
//Common settings
//Small Rectangle background color
Hud.color = [Uicolor Clearcolor]; //Here means no background
//Display of text
Hud.labeltext = @"Test";
//Detail Text
Hud.detailslabeltext = @"Test detail";
//Whether there is 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