progressView的宽度和高度

时间:2016-07-20 18:25:03

标签: ios objective-c progress-bar uiprogressview uiprogressbar

如何创建宽度为100且高度为200的progressView。并将progressView旋转90度?

它无法一起使用。 或progressView被90或更改大小

self.progressView.transform = CGAffineTransformMakeRotation(M_PI_2);
    CGAffineTransform transform = CGAffineTransformMakeScale(1.0f, 3.0f);
    _progressView.transform = transform;

3 个答案:

答案 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)