Domanda

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.

È stato utile?

Soluzione

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);
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top