Search code examples
ios7uislidercgaffinetransform

uislder vertical in ios7-bar issue


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.


Solution

  • 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);