zoukankan      html  css  js  c++  java
  • UIProgressView

    UIProgressView顾名思义用来显示进度的,如音乐,视频的播放进度,和文件的上传下载进度等。

    下面以一个简单的实例来介绍UIprogressView的使用。

    @interface ActivityViewController : UIViewController

    {

        UIProgressView *proView;  

        double proValue;

        NSTimer *timer;

    }

    @property(nonatomic, retain)  UIProgressView *proView;

    -(IBAction)btnStartClick;

    @implementation ActivityViewController

    @synthesize proView;

    #pragma mark - View lifecycle

    -(IBAction)btnStartClick

    {

        proValue=0;

         timer = [NSTimerscheduledTimerWithTimeInterval:1target:selfselector:@selector(changeProgress) userInfo:nilrepeats:YES]; //利用计时器,每隔1秒调用一次(changeProgress)

    }

    -(void)changeProgress

    {

        proValue += 1.0; //改变proValue的值

        if(proValue > 5)

        {

            //停用计时器

            [timer invalidate];        

        }

        else

        {

            [proViewsetProgress:(proValue / 5)];//重置进度条

        }

    }

    - (void)viewDidLoad

    {

        proView = [[UIProgressViewalloc] initWithFrame:CGRectMake(100, 100, 150, 20)];

        [proViewsetProgressViewStyle:UIProgressViewStyleDefault]; //设置进度条类型

        [self.viewaddSubview:proView];

        

        [superviewDidLoad];

    }

    1
  • 相关阅读:
    webService 的使用
    前端框架——树形结构Ztree的使用
    vue使用问题总结(长期更新)
    yum安装配置MySQL数据库
    kworkerds挖矿木马
    zabbix 中文乱码
    GIT 仓库的搭建
    ELK 收集交换机日志(以华为交换机为例)
    Zabbix 邮箱告警(Python脚本)
    Tomcat8性能优化
  • 原文地址:https://www.cnblogs.com/fantasy3588/p/5042402.html
Copyright © 2011-2022 走看看