Basic use of Mbprogresshud

Source: Internet
Author: User


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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.