2

I have UIProgressView and I want to set its corner radius and transform but the corner radius not working as it should be.

My code in Xamarin.ios:

UIProgressView progressView = new UIProgressView(newFrame)
            {             
                //Set background track color = gray
                TrackTintColor = CustomColors.CustomColors.GetColor(CustomColors.CustomColors.ColorGray),

                //Set progress track color = blue
                ProgressTintColor = CustomColors.CustomColors.GetColor(CustomColors.CustomColors.ColorBlue)
            };

            //Set Y scale
            progressView.Transform = CGAffineTransform.Scale(progressView.Transform, 1, 20f);

            progressView.Layer.CornerRadius = 15f;

            progressView.Layer.MasksToBounds = true;

            progressView.ClipsToBounds = true;

progressView :

enter image description here

Hadi Al Tinawi
  • 429
  • 7
  • 22

2 Answers2

1

Unfortunately, I could not find a way to fix it since the CornerRadius doesn't work appropriately after CGAffineTransform.Scale.

Another trick is to set custom TrackImage and ProgressImage then make CGAffineTransform.Scale.

Hadi Al Tinawi
  • 429
  • 7
  • 22
0

It looks like due to transform that is not identity. Try to implement animation with position/bounds and cornerRadius.

numbbuaa
  • 17
  • 3