zoukankan      html  css  js  c++  java
  • UIProgressView进度条的详细使用

    转自http://www.cnblogs.com/aipingguodeli/archive/2012/04/27/2473422.html

    #import "ActivityViewController.h"

    @interface ActivityViewController : UIViewController

    {

        UIProgressView *proView;  

        double proValue;

        NSTimer *timer;

    }

    @property(nonatomic, retain)  UIProgressView *proView;

    -(IBAction)btnStartClick;

    #import "ActivityViewController.m"

    @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

    {

        [super viewDidLoad];

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

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

        [self.view addSubview:proView];

    }

  • 相关阅读:
    JavaScript常见注意点(一)
    jspServlet2.5和Servlet3的区别
    jspMVC案例
    jQuery入口函数的写法
    Servlet 简介
    jspMVC设计模式和Servlet2.5入门案例
    display 属性
    JSON简单使用
    Tomcat修改端口号
    php开发环境简单配置
  • 原文地址:https://www.cnblogs.com/jiangshiyong/p/2835710.html
Copyright © 2011-2022 走看看