• MBProgressHUDDemo


    //

    //  ZBMainViewController.m

    //  MBProgressHUDDemo

    //

    //  Created by 张先森 on 14/11/27.

    //  Copyright (c) 2014年 zhibin. All rights reserved.

    //

    #import "ZBMainViewController.h"

    #import "MBProgressHUD+MJ.h"

    @interface ZBMainViewController ()

    {

        MBProgressHUD *HUD;

    }

    - (IBAction)showTextDialog:(id)sender;

    - (IBAction)showProgressOne:(id)sender;

    - (IBAction)showProgressTwo:(id)sender;

    - (IBAction)showProgressThree:(id)sender;

    - (IBAction)showCustomDialog:(id)sender;

    - (IBAction)showAllTextDialog:(id)sender;

    @end

    @implementation ZBMainViewController

    - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil

    {

        self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];

        if (self) {

            // Custom initialization

        }

        return self;

    }

    - (void)viewDidLoad

    {

        [super viewDidLoad];

        // Do any additional setup after loading the view from its nib.

    }

    - (void)didReceiveMemoryWarning

    {

        [super didReceiveMemoryWarning];

        // Dispose of any resources that can be recreated.

    }

    - (IBAction)showTextDialog:(id)sender {

        HUD=[[MBProgressHUD alloc] initWithView:self.view];

        

        [self.view addSubview:HUD];

        HUD.dimBackground=YES;

        HUD.labelText=@"请稍后";

        

        [HUD showAnimated:YES whileExecutingBlock:^{

            sleep(10);

        } completionBlock:^{

                 [HUD removeFromSuperview];

        }];

        

    }

    - (IBAction)showProgressOne:(id)sender {

        HUD =[[MBProgressHUD alloc] initWithView:self.view];

        [self.view addSubview:HUD];

        HUD.mode=MBProgressHUDModeDeterminate;

          HUD.labelText=@"请稍后";

        [HUD showAnimated:YES whileExecutingBlock:^{

            

            float progress = 0.0f;

            while (progress < 1.0f) {

                progress += 0.01f;

                HUD.progress = progress;

                usleep(10000);

            }

        } completionBlock:^{

            [HUD removeFromSuperview];

       

            HUD = nil;

        }];

        

        

    }

    - (IBAction)showProgressTwo:(id)sender {

        

        HUD=[[MBProgressHUD alloc] initWithView:self.view];

        [self.view addSubview:HUD];

           HUD.labelText=@"请稍后";

        

            HUD.mode=MBProgressHUDModeAnnularDeterminate;

        [HUD showAnimated:YES whileExecutingBlock:^{

            

            float progress = 0.0f;

            while (progress < 1.0f) {

                progress += 0.01f;

                HUD.progress = progress;

                usleep(10000);

            }

        } completionBlock:^{

            [HUD removeFromSuperview];

            

            HUD = nil;

        }];

    }

    - (IBAction)showProgressThree:(id)sender {

        

        HUD=[[MBProgressHUD alloc] initWithView:self.view];

        [self.view addSubview:HUD];

        HUD.labelText=@"请稍后";

        

        HUD.mode=MBProgressHUDModeDeterminateHorizontalBar;

        [HUD showAnimated:YES whileExecutingBlock:^{

            

            float progress = 0.0f;

            while (progress < 1.0f) {

                progress += 0.01f;

                HUD.progress = progress;

                usleep(10000);

            }

        } completionBlock:^{

            [HUD removeFromSuperview];

            

            HUD = nil;

        }];

    }

    - (IBAction)showCustomDialog:(id)sender {

        HUD=[[MBProgressHUD alloc] initWithView:self.view];

        HUD.mode=MBProgressHUDModeCustomView;

         HUD.customView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"tabbar_profile_selected_os7"]];

        

        [self.view addSubview:HUD];

        HUD.labelText=@"请稍后再试试";

        [HUD showAnimated:YES whileExecutingBlock:^{

            

                sleep(2);

            

        } completionBlock:^{

            

            

            [HUD removeFromSuperview];

          

            HUD = nil;

        }];

        

        

    }

    - (IBAction)showAllTextDialog:(id)sender {

        

        HUD = [[MBProgressHUD alloc] initWithView:self.view];

        [self.view addSubview:HUD];

        

        HUD.labelText = @"操作成功";

        HUD.mode = MBProgressHUDModeText;

      //  HUD.customView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Checkmark"]] ];

        [HUD showAnimated:YES whileExecutingBlock:^{

            sleep(2);

        } completionBlock:^{

            [HUD removeFromSuperview];

        

            HUD = nil;

        }];

        

        

    }

    @end

  • 相关阅读:
    机器学习性能指标精确率、召回率、F1值、ROC、PRC与AUC--周振洋
    机器学习项目实战(一)垃圾邮件的过滤技术-周振洋
    Python音频处理(一)音频基础知识-周振洋
    LightGBM详细用法--机器学习算法--周振洋
    LightGBM的算法介绍
    Oracle数据库学习一 (Oracle数据库安装/环境变量配置/客户端/基础/问题...),待续...
    WebService小白学习 之 Spring整合CXF,添加拦截器 (7)
    WebService小白学习 之 CXF添加拦截器,自定义拦截器 (6)
    WebService小白学习 之 处理一些Map等复杂类型 (5)
    WebService小白学习 之 处理JavaBean以及复合类型,list (4)
  • 原文地址:https://www.cnblogs.com/zhibin/p/4127345.html
Copyright © 2020-2023  润新知