Morpho Morpho - 1 year ago 147
iOS Question

UIProgressView progress value rounds

A have an issue with UIProgressView value. I'm trying to embed ProgressView into Table View cell.
This code works - ProgressView fills it's cell. But there's problem with filling ProgressView itself - it's value rounds to 0.5 (e.g. if value is 0.2 then progressView is not filled, if 0.8 - then it filled 100%, see the image bellow)
Can anyone help with making things right?

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

Answer Source


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;

Make sure set frame before transform.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download