IOS asynchronous task progress loading prompt tool, ios progress loading

Source: Internet
Author: User

IOS asynchronous task progress loading prompt tool, ios progress loading
I. Introduction

DMProgressHUD is a View tool used to display the progress of Asynchronous Operation tasks. This tool contains the mainstream loading Status view types, which will be iterated in the future based on the actual situation or requirements. DMProgressHUD has five display modes at the design level:

Ii. Import (Platform: ios> = 8.0) solution 1: CocoaPods solution 2: direct import to project 3. Quick call

Note: use the default Style-Dark, Animation-gradient, and Mask-None for quick calls ).

1. Loading Mode1.1 Loading-Indicator

DMProgressHUD * hud = [DMProgressHUD showLoadingHUDAddedTo: self. view]; // hud. loadingType = DMProgressHUDLoadingTypeIndicator; // The default value is hud. text = @ "Here's info"; dispatch_async (dispatch_get_global_queue (queue, 0), ^ {// asynchronous time-consuming operation [self doSomething]; dispatch_async (dispatch_get_main_queue (), ^ {// The main return thread hides the HUD [hud dismiss] ;});

 

1.2 Loading-Circle

DMProgressHUD * hud = [DMProgressHUD showLoadingHUDAddedTo: self. view]; hud. loadingType = DMProgressHUDLoadingTypeCircle; hud. text = @ "Here's info"; dispatch_async (dispatch_get_global_queue (queue, 0), ^ {// asynchronous time-consuming operation [self doSomething]; dispatch_async (dispatch_get_main_queue (), ^ {// The main return thread hides the HUD [hud dismiss] ;});

 

2. Progress Mode2.1 Progress-Circle

DMProgressHUD * hud = [DMProgressHUD showProgressHUDAddedTo: self. view]; // hud. progressType = DMProgressHUDProgressTypeCircle; // The default value is hud. text = @ "Here's info"; dispatch_async (dispatch_get_global_queue (queue, 0), ^ {// asynchronous time-consuming operation [self doSomething]; dispatch_async (dispatch_get_main_queue (), ^ {// The main return thread hides the HUD [hud dismiss] ;});

 

2.2 Progress-Sector

DMProgressHUD * hud = [DMProgressHUD showProgressHUDAddedTo: self. view]; hud. progressType = DMProgressHUDProgressTypeSector; hud. text = @ "Here's info"; dispatch_async (dispatch_get_global_queue (queue, 0), ^ {// asynchronous time-consuming operation [self doSomething]; dispatch_async (dispatch_get_main_queue (), ^ {// The main return thread hides the HUD [hud dismiss] ;});

 

3. Status Mode3.1 Success

DMProgressHUD * hud = [DMProgressHUD showStatusHUDAddedTo: self. view statusType: DMProgressHUDStatusTypeSuccess]; hud. text = @ "Here's info"; dispatch_async (dispatch_get_global_queue (queue, 0), ^ {// asynchronous time-consuming operation [self doSomething]; dispatch_async (dispatch_get_main_queue (), ^ {// The main return thread hides the HUD [hud dismiss] ;});

 

3.2 Fail

DMProgressHUD * hud = [DMProgressHUD showStatusHUDAddedTo: self. view statusType: DMProgressHUDStatusTypeFail]; hud. text = @ "Here's info"; dispatch_async (dispatch_get_global_queue (queue, 0), ^ {// asynchronous time-consuming operation [self doSomething]; dispatch_async (dispatch_get_main_queue (), ^ {// The main return thread hides the HUD [hud dismiss] ;});

 

3.3 Warning

DMProgressHUD * hud = [DMProgressHUD showStatusHUDAddedTo: self. view statusType: DMProgressHUDStatusTypeWarning]; hud. text = @ "Here's info"; dispatch_async (dispatch_get_global_queue (queue, 0), ^ {// asynchronous time-consuming operation [self doSomething]; dispatch_async (dispatch_get_main_queue (), ^ {// The main return thread hides the HUD [hud dismiss] ;});

 

4. Text Mode4.1 Text

DMProgressHUD * hud = [DMProgressHUD showTextHUDAddedTo: self. view]; hud. text = @ "Here's info"; dispatch_async (dispatch_get_global_queue (queue, 0), ^ {// asynchronous time-consuming operation [self doSomething]; dispatch_async (dispatch_get_main_queue (), ^ {// The main return thread hides the HUD [hud dismiss] ;});

 

5. Custom Mode5.1 Custom

DMProgressHUD * hud = [DMProgressHUD showHUDAddedTo: self. view]; hud. mode = DMProgressHUDModeCustom; // specify the mode as the custom mode hud. text = @ "Here's info"; UIView * custom = [[UIImageView alloc] initWithImage: [UIImage imageNamed: @ "person"]; [hud setCustomView: custom width: 180.0 height: 180.0]; // custom View dispatch_async (dispatch_get_global_queue (queue, 0), ^ {// asynchronous time-consuming operation [self doSomething]; dispatch_async (dispatch_get_main_queue (), ^ {// The main return thread hides the HUD [hud dismiss] ;});

 

4. More

DMProgressHUDRun DemoView the effect. In addition, you canText spacing, color, etc.For customization, you canDMProgressHUD. hFile to view more API details.

More articles: simplified books

Contact info: damonmok1216@gmail.com.

Related Article

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.