0
Xamarinのセミプログレスバーを表す画像上にパスを描きたい。それはトップのために働く。Xamarin iOS UIBezierPath方向を下に移動
しかし、今私は底を描きたい。しかし、何も見つけずに試してみました。
画像が説明されます。 Image
コード:
public CircleGraph(UIImageView imageView, int lineWidth, float percentComplete) : base(imageView.Frame)
{
Initialise(imageView, lineWidth, percentComplete);
}
void Initialise(UIImageView imageView, int lineWidth, float percentComplete)
{
_lineWidth = lineWidth;
_percentComplete = percentComplete;
this.BackgroundColor = UIColor.Clear;
this.backgroundImage = imageView;
Add(backgroundImage);
centerPoint = new CGPoint(Bounds.GetMidX(), Bounds.Height);
maskLayer = new CAShapeLayer();
maskLayer.FillColor = UIColor.Blue.CGColor;
maskLayer.StrokeColor = UIColor.Black.ColorWithAlpha(.5f).CGColor;
maskLayer.LineWidth = _lineWidth;
maskLayer.LineCap = CAShapeLayer.CapButt;
this.Layer.Mask = maskLayer;
}
public void SetClipping(float percentComplete) {
_percentComplete = percentComplete;
SetNeedsDisplay();
}
public override void Draw(CoreGraphics.CGRect rect)
{
base.Draw(rect);
using (CGContext g = UIGraphics.GetCurrentContext())
{
_radius = (int)(this.Bounds.Width/2) - _lineWidth/2;
// Top
var startAngle = -(float)Math.PI;
var endAngle = startAngle + HALF_CIRCLE * _percentComplete;
maskPath = new UIBezierPath();
maskPath.AddArc(centerPoint, _radius, startAngle, endAngle, false);
maskLayer.Path = maskPath.CGPath;
};
}
どうもありがとう!