문제

i want to make my UISlider Vertical.I am using Slider in IB and the below code for changing it in to vertical.

CGAffineTransform trans = CGAffineTransformMakeRotation(M_PI * 0.5);
slider.transform = trans;   

But i can able to see the thumb alone,not able to see the bar. And i tried,

CGAffineTransform trans = CGAffineTransformMakeRotation(M_PI * 1.5);
slider.layer.transform = trans;

getting error as

Assigning to 'CATransform3D' (aka 'struct CATransform3D') from incompatible type 'CGAffineTransform' (aka 'struct CGAffineTransform')

Please help.

도움이 되었습니까?

해결책

Thats because in the second statement you are trying to assign a CGAffineTransform transform to slider.layer.transform which is of type CATransform3D.

here is the code I use to rotate my slider

[self.layer setAnchorPoint:CGPointMake(0.0f, 0.0f)];
self.transform = CGAffineTransformMakeRotation(M_PI/2);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top