【转】自定义垂直的UISlider

时间:2022-11-02 18:12:28

原文网址:http://www.cocoachina.com/bbs/read.php?tid=96282

怎样自定义垂直的UISlider?

UISlider弄成垂直的代码就是:
slider.transform =  CGAffineTransformMakeRotation( M_PI * 0.5 );

自定义滑块和滑槽的代码:
UIImage* trackImg = [UIImage imageNamed: @"a.png"];

[slider setMinimumTrackImage: trackImg forState: UIControlStateNormal];
[slider setMaximumTrackImage: trackImg forState: UIControlStateNormal];

UIImage* thumbImg = [UIImage imageNamed: @"b.png"];

[slider setThumbImage: thumbImg forState: UIControlStateHighlighted];
[slider setThumbImage: thumbImg forState: UIControlStateNormal];