• MBProgress的使用方法


    1.MBProgressHUD 的弹窗的消息的界面,三种的方式:

    第一种的方式: 

    -(void)myTask{

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

        [self.view addSubview:HUD];

         HUD.labelText = @"自动扫描中";

         [HUD showWhileExecuting:@selector(myTask) onTarget:self withObject:nil animated:YES];

        sleep(10);

        [self show]; 

    }

    -(void)show {

        [self.HUD removeFromSuperview];

        TestViewController *test = [[TestViewController alloc]init];

        [self presentViewController:test animated:YES completion:nil];

    }

    第二种的方式:(使用了mb里面的回调的函数)

    //使用了回调的方法

    -(void)myTask1{

        int duration = 5;

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

        [self.view addSubview: HUD];

        HUD.labelText = @"正在登录,请稍等....";

        [HUD showAnimated:YES whileExecutingBlock:^{

            sleep(duration);

        } completionBlock:^{

            [HUD removeFromSuperview];

            [self show];

        }]; 

    }

    -(void)show {

        [self.HUD removeFromSuperview];

        TestViewController *test = [[TestViewController alloc]init];

        [self presentViewController:test animated:YES completion:nil];

    }

    第三种方式:(整个屏幕都充满)

    -(void)myTask2{

         self.HUD = [[MBProgressHUD alloc]init];

        self.HUD = [MBProgressHUD showMessage:@"正在查询,请稍等片刻"];

        self.HUD.delegate = self;

        self.timer =   [NSTimer scheduledTimerWithTimeInterval:10 target:self selector:@selector(show) userInfo:nil repeats:NO];   

    }

    -(void)show {

        [self.HUD removeFromSuperview];

        TestViewController *test = [[TestViewController alloc]init];

        [self presentViewController:test animated:YES completion:nil];

        }

    #pragma  mark - MBProgressHUD (MB里面没有这个代理方法,新加了一个方法)

    - (void)hudViewWasTapped{

         NSLog(@"调用hud的代理方法");

        [self.HUD removeFromSuperview];

        self.timer = nil;

        self.HUD = nil;

    }

  • 相关阅读:
    [初学Untiy]SPACE SHOOTER TUTORIAL
    [OpenGL]第一章 OpenGL概述
    DSAA 第一章 引论
    Learn Python The Hard Way(27--)
    linux 系统tty、pty和pts 的概念及区别
    stuffs of install ubuntu
    第八章、Linux 磁盘与文件系统管理
    第七章 Linux文件与目录管理
    切换不同的echarts时,出现图标缩小,报警告,Can’t get dom width or height!
    echarts x轴的纵向区域随便点击获取点击的x轴那一纵向区域的值
  • 原文地址:https://www.cnblogs.com/zhufeng1994/p/4638493.html
Copyright © 2020-2023  润新知