zoukankan      html  css  js  c++  java
  • 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;

    }

  • 相关阅读:
    javascript--Date
    PL/SQL的命令行窗口中执行脚本
    关于资产新增接口问题描述
    ORA-00600: internal error code, arguments: [kqludp2], [0x08D226918], [0], [], [], [], [], [], [], [], [], []
    Oracle 表空间扩容
    EBS 创建会计科目 小结
    EBS AP 创建会计科目失败
    EBS GL 日记账行“账户说明”段说明显示不全
    EBS 修改系统名称
    EBS 修改系统颜色
  • 原文地址:https://www.cnblogs.com/zhufeng1994/p/4638493.html
Copyright © 2011-2022 走看看