UIProgressView进度值轮次

时间:2016-09-05 12:09:44

标签: ios objective-c

A有UIProgressView值的问题。我正在尝试将ProgressView嵌入到Table View单元格中。 此代码有效 - ProgressView填充它的单元格。但是填充ProgressView本身存在问题 - 它的值为0.5(例如,如果值为0.2则则未填充progressView,如果为0.8 - 则填充100%,请参见下图) 任何人都可以帮助做正确的事吗?

CGAffineTransform transform = CGAffineTransformMakeScale(cell.frame.size.width, cell.frame.size.height);
cell.attendanceProgress.transform = transform;
[cell.attendanceProgress setAlpha:0.5];
[cell setUserInteractionEnabled:NO];
float progr = (float)attended / (float)classes.count;
if (classes.count == 0) { progr = 0; }
[cell.attendanceProgress setProgress:progr];

displays in app

1 个答案:

答案 0 :(得分:0)

使用

cell.attendanceProgress.frame=CGRectMake(0,0,cell.attendanceProgress.frame.size.width, cell.frame.size.height);
CATransform3D transform = CATransform3DScale(cell.attendanceProgress.layer.transform, 1.0f,cell.frame.size.height, 1.0f);
cell.attendanceProgress.layer.transform = transform;

确保在变换前设置帧。