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];

  • 相关阅读:
    视图
    Adaboost算法
    关于友谊的残酷真相
    排序与搜索
    队列

    Xgboost集成算法
    川普“零容忍”政策:拆散移民家庭惹争议
    第八篇:使用字符串流对象进行格式转换
    第七篇:两个经典的文件IO程序示例
  • 原文地址:https://www.cnblogs.com/iOS-mt/p/4143677.html
Copyright © 2011-2022 走看看