UIProgressView控件

用处:进度条视图,用来显示某个任务的当前状态

-(void)viewDidLoad

{

  [self viewDidLoad];

  self.timer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(change:) userInfo:nil repeats:YES];

     self.pv = [[UIProgressView alloc]initWithProgressViewStyle:UIProgressViewStyleDefault];

  

  self.pv.frame = CGMake(20,20,100,20);

  //进度颜色

  self.pv.progressTintColor = [UIColor redColor];

  //底色颜色

  self.pv.trackTintColor = [UIColor greenColor];

  //当前进度

  self.pv.progress = 0.0;

  [self.view addSubView:self.pv];

}

-(IBAction) change:(NSTimer*)myTimer

{

  self.pv.progress +=0.1;

  [self.timer invalidate];

}

posted @ 2014-08-07 13:56  迷茫的程序小生  阅读(154)  评论(0编辑  收藏  举报