This third party and Mbprogresshud is similar, also quite simple.
////VIEWCONTROLLER.M//Progresshud////Created by City--online on 15/6/15.//Copyright (c) 2015 City--online. All rights reserved.//#import "ViewController.h"#import "SVProgressHUD.h"@interfaceViewcontroller ()@end@implementationViewcontroller- (void) Viewwillappear: (BOOL) animated {[Super viewwillappear:animated]; [[Nsnotificationcenter Defaultcenter] addobserver:self selector: @selector (hand Lenotification:) name:svprogresshudwillappearnotification Object: nil]; [[Nsnotificationcenter Defaultcenter] addobserver:self selector: @selector (hand Lenotification:) name:svprogresshuddidappearnotification Object: nil]; [[Nsnotificationcenter Defaultcenter] addobserver:self selector: @selector (hand Lenotification:) name:svprogresshudwilldisappearnotification Object: nil]; [[Nsnotificationcenter Defaultcenter] addobserver:self selector: @selector (hand Lenotification:) name:svprogresshuddiddisappearnotification Object: nil];}- (void) Handlenotification: (Nsnotification *) notif{NSLog (@"Notification recieved:%@", Notif.name); NSLog (@"Status User Info key:%@", [Notif.userinfo Objectforkey:svprogresshudstatususerinfokey]);}- (void) viewdidload {[Super viewdidload]; UIButton*btn=[UIButton Buttonwithtype:uibuttontypesystem]; [BTN Settitle:@"Prompt Box"Forstate:uicontrolstatenormal]; Btn.frame=cgrectmake ( -, -, -, -); [Btn addtarget:self Action: @selector (Btnclick:) forcontrolevents:uicontroleventtouchupinside]; [Self.view addsubview:btn];}-(void) Btnclick: (ID) sender{//[Svprogresshud showwithstatus:@ "Loading"];//[Svprogresshud show];//Dispatch_async (dispatch_get_global_queue (dispatch_queue_priority_default, 0), ^{//sleep (3);//Dispatch_async (Dispatch_get_main_queue (), ^{//[Svprogresshud dismiss];// });// }); //[self showwithprogress];[self showsuccess];}Static floatProgress =0.0f;- (void) showwithprogress {Progress=0.0f; [Svprogresshud showprogress:0Status@"Loading"]; [Self performselector: @selector (increaseprogress) withobject:nil Afterdelay:0.3f];}- (void) increaseprogress {Progress+=0.1f; [Svprogresshud showprogress:progress Status:@"Loading"]; if(Progress <1.0f) [Self performselector: @selector (increaseprogress) withobject:nil Afterdelay:0.3f]; Else[Self performselector: @selector (Dismiss) Withobject:nil Afterdelay:0.4f];}- (void) Dismiss {[Svprogresshud dismiss];}- (void) showinfo{[Svprogresshud showinfowithstatus:@"useful information."];}- (void) showsuccess {[Svprogresshud showsuccesswithstatus:@"Great success!"];}- (void) ShowError {[Svprogresshud showerrorwithstatus:@"Failed with Error"];}- (void) didreceivememorywarning {[Super didreceivememorywarning]; //Dispose of any resources the can be recreated.}@end
iOS third party Svprogresshud