iOS third party Svprogresshud

Source: Internet
Author: User

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

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.