拖动条和进度条非常相似
只是进度条采用颜色填充来标明进度完成的程度,拖动条则通过滑块的位置来标识数值
UIImage* minImage=[[UIImage imageNamed:@"images/heart.gif"]
resizableImageWithCapInsets:UIEdgeInsetsZero resizingMode:UIImageResizingModeTile];
UIImage* trackImage=[[UIImage imageNamed:@"images/ic_launcher.png"]
resizableImageWithCapInsets:UIEdgeInsetsZero
resizingMode:UIImageResizingModeTile];
UIImage* maxImage=[[UIImage imageNamed:@"images/grow.gif"]
resizableImageWithCapInsets:UIEdgeInsetsZero resizingMode:UIImageResizingModeTile];
UIImage* imageIV=[UIImage imageNamed:@"images/lijiang.jpg"];
self.iv=[[UIImageView alloc]initWithFrame:CGRectMake(0, 40, 450, 300)];
self.iv.image=imageIV;
[self.view addSubview:self.iv];
//@"images/ic_launcher.png"
self.slider=[[UISlider alloc]initWithFrame:CGRectMake(0, 300, 450, 40)];
[self.slider setMinimumTrackImage:minImage forState:UIControlStateNormal];
[self.slider setMaximumTrackImage:maxImage forState:UIControlStateNormal];
[self.slider setThumbImage:trackImage forState:UIControlStateNormal];
self.slider.value=0.0;
[self.slider addTarget:self action:@selector(change:) forControlEvents:UIControlEventValueChanged];
[self.view addSubview:self.slider];
// Do any additional setup after loaing the view, typically from a nib.
}
-(void)change:(UISlider*)sender{
//
[self.iv setAlpha:sender.value];
}