如何创建宽度为100且高度为200的progressView
。并将progressView
旋转90度?
它无法一起使用。
或progressView
被90或更改大小
self.progressView.transform = CGAffineTransformMakeRotation(M_PI_2);
CGAffineTransform transform = CGAffineTransformMakeScale(1.0f, 3.0f);
_progressView.transform = transform;
答案 0 :(得分:2)
你需要链接你的转换。在您的示例中,transform
的第二个分配有效地覆盖了第一个分配。这个有效:
UIProgressView *progressBar = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleBar];
progressBar.frame = CGRectMake(50, 100, 100, 50);
CGAffineTransform t = CGAffineTransformMakeRotation(M_PI_2);
t = CGAffineTransformScale(t, 1.0f, 50.0f);
progressBar.transform = t;
[self.view addSubview:progressBar];
答案 1 :(得分:0)
我在某处读到过......我认为CGAffineTransform()
适用于那个
[self.progressView setTransform:CGAffineTransformMakeScale(1.0, 2.0)];
轮换
#define DEGREES_TO_RADIANS(angle) ((90) / 180.0 * M_PI)
[self.progressView setTransform:CGAffineTransformMakeRotation(DEGREES_TO_RADIANS(angle))];
答案 2 :(得分:0)
快捷键4
progressView.transform = CGAffineTransform(scaleX: 1.0, y: 2.0)