我目前正在尝试在Objective-C中创建四个垂直滑块。我可以使用CGAffineTransform
旋转它们,但现在每个滑块彼此堆叠。如何更改滑块的坐标,以免发生这种情况?
下面是我旋转滑块的代码:
CGAffineTransform trans1 = CGAffineTransformMakeRotation(M_PI * 1.5);
_grainPitchSlider.transform = trans1;
CGAffineTransform trans2 = CGAffineTransformMakeRotation(M_PI * 1.5);
_grainOffsetSlider.transform = trans2;
CGAffineTransform trans3 = CGAffineTransformMakeRotation(M_PI * 1.5);
_grainDensitySlider.transform = trans3;
CGAffineTransform trans4 = CGAffineTransformMakeRotation(M_PI * 1.5);
_grainDurationSlider.transform = trans4;
最佳答案
只需设置每个滑块的“中心”,即_grainPitchSlider.center = CGPointMake(x, y);