progressView的宽高
Width and height of progressView
如何创建宽度为 100、高度为 200 的 progressView
。并将 progressView
旋转 90 度?
不能一起使用。
或progressView
转90或改变尺寸
self.progressView.transform = CGAffineTransformMakeRotation(M_PI_2);
CGAffineTransform transform = CGAffineTransformMakeScale(1.0f, 3.0f);
_progressView.transform = transform;
我在某处读到过...我认为 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))];
您需要链接您的转换。在您的示例中,对 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];
Swift 4
progressView.transform = CGAffineTransform(scaleX: 1.0, y: 2.0)
如何创建宽度为 100、高度为 200 的 progressView
。并将 progressView
旋转 90 度?
不能一起使用。
或progressView
转90或改变尺寸
self.progressView.transform = CGAffineTransformMakeRotation(M_PI_2);
CGAffineTransform transform = CGAffineTransformMakeScale(1.0f, 3.0f);
_progressView.transform = transform;
我在某处读到过...我认为 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))];
您需要链接您的转换。在您的示例中,对 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];
Swift 4
progressView.transform = CGAffineTransform(scaleX: 1.0, y: 2.0)