您的位置:首页 > 产品设计 > UI/UE

UIProgressView

2016-07-03 20:54 471 查看
#import "ViewController.h"

@interface ViewController ()
{
UIProgressView *progressView;
BOOL isFill;
}
@end

@implementation ViewController

- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
isFill = NO;
progressView = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleDefault];
[self.view addSubview:progressView];
progressView.frame = CGRectMake(10,100,300,100);
//progressView.center=CGPointMake(160,100);
progressView.progress = 0.1;
progressView.tintColor = [UIColor redColor];
progressView.trackTintColor = [UIColor greenColor];
//progressView.progressImage = [UIImage imageNamed:@"loading_0.png"];
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
//[progressView setProgress:arc4random()%10/10.0 animated:YES];
if(progressView.progress==1.0){
isFill = YES;
}else if(progressView.progress==0.0){
isFill = NO;
}
if(!isFill) {
float f = progressView.progress + 0.5;
[progressView setProgress:f animated:YES];
}else{
float f = progressView.progress - 0.5;
[progressView setProgress:f animated:YES];
}
}

- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}

@end


内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: