自定义 UISlider 旋转方向

#define degressToRadian(x) (M_PI * (x)/180.0)

widthSlider= [[UISlideralloc]initWithFrame:CGRectMake(0,100,200,20)];

widthSlider.minimumValue=0;//最小值

widthSlider.maximumValue=50;//最大值

widthSlider.value=14;//默认值

[widthSlideraddTarget:selfaction:@selector(sliderValueChanged:)forControlEvents:UIControlEventValueChanged];

[self.viewaddSubview:widthSlider];

[widthSlidersetThumbImage:[UIImageimageNamed:@"11"]forState:UIControlStateNormal];

CGAffineTransformrotation =CGAffineTransformMakeRotation(degressToRadian(90));

[widthSlidersetTransform:rotation];

-(void)sliderValueChanged:(id)sender

{

NSLog(@"slider value%f",widthSlider.value);

self.drawingView.lineWidth=widthSlider.value;

}




自定义 UISlider 旋转方向_第1张图片

你可能感兴趣的:(自定义 UISlider 旋转方向)