Ios_ 3rd party Class library Mbprogresshud simple to use

Source: Internet
Author: User

1, will download the 3rd party class Library Mbprogresshud source Package added to the project (in fact, is a. h and. m files)

2, enter the project build phases, the source package inside all the. m files are added to the project

3, add the 3rd party class Library's main header file " MBProgressHUD.h "


Display code:

Start loading, display cue bar    mbprogresshud *hud = [Mbprogresshud showhudaddedto:webview animated:yes];    Add a layer mask    hud.dimbackground = YES;    Hud.labeltext = @ "page loaded ...";
Hide Code:

Once loaded, hide the cue bar    [Mbprogresshud Hideallhudsforview:webview Animated:yes];

Custom Display Picture:

Extracted, only for categorical internal calls + (void) ShowMsg: (NSString *) msg imgname: (NSString *) imgname{    //Display to main window Mbprogresshud *hud    =[ Mbprogresshud showhudaddedto:[uiapplication Sharedapplication].keywindow Animated:yes];        Display mode, change to CustomView, that is, display a custom picture (mode setting, must be written before CustomView Assignment)    hud.mode = Mbprogresshudmodecustomview;            int delay = 1;       if ([Imgname isequaltostring:@ "Error.png"]) {        //error, Prompt for 3 seconds        delay = 3;    }        Imgname = [NSString stringwithformat:@ "mbprogresshud.bundle/%@", imgname];    Set the custom picture to display    Hud.customview = [[Uiimageview alloc] initwithimage:[uiimage Imagenamed:imgname]];    Displayed text, such as: Load failed ... Loading in ...    Hud.labeltext = msg;    Flag: Must be yes to hide and  remove    Hud.removefromsuperviewonhide = yes from parent control when hidden;    Log is automatically hidden after 3 seconds        (@ "%d", delay);    [HUD Hide:yes afterdelay:delay];}
Other Common Properties
The background color of the cue box Hud.color = [Uicolor clearcolor];//here means little text with no background//hint below hud.detailslabeltext = @ "Detail";  Shadow Matte effect hud.dimbackground = YES;  Hide [HUD Hide:yes afterdelay:1] after 1 seconds;  Show Text Only hud.mode = Mbprogresshudmodetext;  Margin and y-direction offset hud.margin = 0;  Hud.yoffset = 0;  Remove hud.removefromsuperviewonhide = YES from the parent control after hiding; Round progress bar Hud.mode = Mbprogresshudmodeannulardeterminate;




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.