【问题标题】:Set Corner Radius after setting Transform nor working IOS设置转换后设置角半径不工作 IOS
【发布时间】:2017-06-15 13:53:09
【问题描述】:

我有 UIProgressView,我想设置它的圆角半径并进行变换,但圆角半径不能正常工作。

我在 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;

进度视图:

【问题讨论】:

    标签: ios transform uiprogressview cornerradius


    【解决方案1】:

    不幸的是,我找不到修复它的方法,因为 CornerRadius 在 CGAffineTransform.Scale 之后无法正常工作。

    另一个技巧是设置自定义 TrackImage 和 ProgressImage 然后制作 CGAffineTransform.Scale。

    【讨论】:

      【解决方案2】:

      看起来由于转换不是身份。尝试使用位置/边界和角半径来实现动画。

      【讨论】:

      • 只是评论,低质量。
      • 我遇到了同样的问题,用上面的方法解决了。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-05-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-10-01
      • 1970-01-01
      • 2021-06-12
      相关资源
      最近更新 更多