Ios Objective-C:以编程方式查看进度

Ios Objective-C:以编程方式查看进度,ios,objective-c,progress,Ios,Objective C,Progress,如何在Xcode项目中以编程方式创建高度为50且圆角的progressView 如果我使用这个代码 CGAffineTransform transform = CGAffineTransformMakeScale(1.0f, 3.0f); progressView.transform = transform; 圆角消失 UIProgressView *progressView = [[UIProgressView alloc] initWithProgressViewStyle:what

如何在Xcode项目中以编程方式创建高度为50且圆角的
progressView

如果我使用这个代码

CGAffineTransform transform = CGAffineTransformMakeScale(1.0f, 3.0f);  
progressView.transform = transform;
圆角消失

 UIProgressView *progressView = [[UIProgressView alloc] initWithProgressViewStyle:whateverStyle]
progressView.progress = 0.75f;
//设置高度和转角

[[UIProgressView appearance] setFrame:CGRectMake(20, 100, 280, 50)];
[progressView.layer setCornerRadius:4];
 progressView.layer.masksToBounds = TRUE;
 progressView.clipsToBounds = TRUE;

[self.view addSubview: progressView]
//设置高度和转角

[[UIProgressView appearance] setFrame:CGRectMake(20, 100, 280, 50)];
[progressView.layer setCornerRadius:4];
 progressView.layer.masksToBounds = TRUE;
 progressView.clipsToBounds = TRUE;

[self.view addSubview: progressView]

我试着用圆角获取进度视图,我成功了

首先,您需要添加和导入

#import <QuartzCore/QuartzCore.h>


我尝试使用圆角获取进度视图。我成功了

首先,您需要添加和导入

#import <QuartzCore/QuartzCore.h>

您可以使用以下代码:

UIProgressView *progressView = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleBar];
    progressView.progress = 0.75f;
    [progressView.layer setCornerRadius:10];
    progressView.layer.masksToBounds = TRUE;
   progressView.clipsToBounds = TRUE;
    CGAffineTransform transform = CGAffineTransformMakeScale(1.0f, 10.0f);
    progressView.transform = transform;

    [self.view addSubview: progressView];
您可以使用以下代码:

UIProgressView *progressView = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleBar];
    progressView.progress = 0.75f;
    [progressView.layer setCornerRadius:10];
    progressView.layer.masksToBounds = TRUE;
   progressView.clipsToBounds = TRUE;
    CGAffineTransform transform = CGAffineTransformMakeScale(1.0f, 10.0f);
    progressView.transform = transform;

    [self.view addSubview: progressView];

这个问题的可能重复并不能解决我的问题。如果你的问题是你不能改变身高,那么你应该在问题中提到。有人怎么可能从这个问题中看出这一点呢?请检查我的答案用户214155。这个问题的可能重复并不能解决我的问题。如果你的问题是你不能改变身高,那么你应该在问题中提到。如果你想改变高度,那么你必须通过自定义绘制方法来实现。是的,但是圆角会随着自定义绘制方法的使用而消失。这里有一个允许设置高度的第三方进度条。高度不变如果要更改高度,则必须通过自定义绘制方法实现。是的,但圆角会随着自定义绘制方法而消失。这是一个第三方进度条,允许设置高度。