自定义UIProgressBar

UIProgressBar *pProgress = [[UIProgressBar alloc] initWithFrame:CGRectMake(50, 5, 200, 20)];	
pProgress.minValue = 0;
pProgress.maxValue = 10;
pProgress.currentValue = 5;		
[self.view addSubview:pProgress];	
[pProgress release];	

UIProgressBar *pProgress1 = [[UIProgressBar alloc] initWithFrame:CGRectMake(50, 30, 200, 20)];
pProgress1.minValue = 0;
pProgress1.maxValue = 10;
pProgress1.currentValue = 5;	
[pProgress1 setLineColor:[UIColor redColor]];	
[pProgress1 setProgressColor:[UIColor blueColor]];	
[pProgress1 setProgressRemainingColor:[UIColor yellowColor]];
[self.view addSubview:pProgress1];	
[pProgress1 release];	

UIProgressBar *pProgress2 = [[UIProgressBar alloc] initWithFrame:CGRectMake(50, 55, 200, 20)];
pProgress2.minValue = 0;
pProgress2.maxValue = 10;
pProgress2.currentValue = 5;	
[pProgress2 setLineColor:[UIColor whiteColor]];	
[pProgress2 setProgressColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"1.png"]]];	
[pProgress2 setProgressRemainingColor:[UIColor blackColor]];
[self.view addSubview:pProgress2];	
[pProgress2 release];

 

示例图:


你可能感兴趣的:(ios,iPhone,UIProgressBar)