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;

    }

  • 相关阅读:
    项目中的*签到*小功能!
    亲们,拿到DateTime.Now你是否也是这样比较的?
    <input type="file" />,美化自定义上传按钮
    让你的页面实现自定义的 Ajax Loading加载的体验!
    按回车键提交表单!
    字符串比较大小,CompareTo来搞定!
    巧用Contains可以做到过滤同类项!
    项目开发中遇到的Bug知识整理!
    SharePoint中详细的版本对比
    ASP.NET安全隐患及SharePoint中的Workaround
  • 原文地址:https://www.cnblogs.com/zhufeng1994/p/4638493.html
Copyright © 2011-2022 走看看