Beispiel #1
0
        public ProgressSpinnerView(CGRect frame, NSProgress progress) : base(frame)
        {
            // Initialize
            Progress = progress;
            Progress.AddObserver(this, "fractionCompleted", NSKeyValueObservingOptions.New, IntPtr.Zero);

            ArcLayer.Path = UIBezierPath.FromArc(new CGPoint(Bounds.GetMidX(), Bounds.GetMidY()),
                                                 (float)(0.2f * Math.Min(Bounds.Width, Bounds.Height)),
                                                 (float)(-(Math.PI / 2f)),
                                                 (float)(2f * Math.PI - (Math.PI / 2f)),
                                                 true).CGPath;

            ArcLayer.StrokeColor = TintColor.CGColor;
            ArcLayer.FillColor   = UIColor.Clear.CGColor;
            ArcLayer.LineWidth   = 5;
            ArcLayer.StrokeStart = 0;
            ArcLayer.StrokeEnd   = 0;
            ArcLayer.Position    = CGPoint.Empty;
            Layer.AddSublayer(ArcLayer);

            BackgroundColor    = UIColor.Clear;
            Layer.BorderColor  = UIColor.LightGray.CGColor;
            Layer.BorderWidth  = 2;
            Layer.CornerRadius = 10;

            ProgressLabel.Text          = "0%";
            ProgressLabel.TextAlignment = UITextAlignment.Center;
            ProgressLabel.Frame         = Bounds;
            AddSubview(ProgressLabel);
        }
 public void Initialize()
 {
     progress.AddObserver(this, "fractionCompleted", NSKeyValueObservingOptions.New, progressViewKVOContext);
 }