コード例 #1
0
        void CreateRadialGauge()
        {
            this.radialGauge = new TKRadialGauge();
            this.View.AddSubview(this.radialGauge);

            TKGaugeRadialScale scale = new TKGaugeRadialScale();

            this.radialGauge.AddScale(scale);
            scale.StartAngle    = 0;
            scale.EndAngle      = (nfloat)Math.PI * 2.0f;
            scale.Stroke        = new TKStroke(UIColor.Clear);
            scale.Ticks.Hidden  = true;
            scale.Labels.Hidden = true;
            // >> gauge-customize-cs
            for (int i = 0; i < 3; i++)
            {
                TKGaugeSegment segment = new TKGaugeSegment(new NSNumber(0), new NSNumber(100));
                segment.Fill     = new TKSolidFill(this.colors[i].ColorWithAlpha(0.4f));
                segment.Width    = 0.2f;
                segment.Location = 0.5f + i * 0.25f;
                segment.Cap      = TKGaugeSegmentCap.Round;
                scale.AddSegment(segment);

                TKGaugeSegment gradientSegment = new TKGaugeSegment();
                UIColor[]      colors          = new UIColor[] { this.colors[i], this.colors [i + 3] };
                gradientSegment.Fill     = new TKLinearGradientFill(colors, new CGPoint(0.0f, 0.0f), new CGPoint(1.0f, 1.0f));
                gradientSegment.Width    = 0.2f;
                gradientSegment.Location = 0.5f + i * 0.25f;
                gradientSegment.Cap      = TKGaugeSegmentCap.Round;
                scale.AddSegment(gradientSegment);
                gradientSegment.SetRange(new TKRange(new NSNumber(0), new NSNumber(20 + this.r.Next(50))), 0.5f, CAMediaTimingFunction.EaseInEaseOut);
            }
            // << gauge-customize-cs
        }
コード例 #2
0
        void CreateLinearGauge()
        {
            this.linearGauge = new TKLinearGauge();
            this.View.AddSubview(this.linearGauge);

            TKGaugeLinearScale scale = new TKGaugeLinearScale();

            scale.Stroke        = new TKStroke(UIColor.Clear);
            scale.Ticks.Hidden  = true;
            scale.Labels.Hidden = true;
            this.linearGauge.AddScale(scale);

            for (int i = 0; i < 3; i++)
            {
                TKGaugeSegment segment = new TKGaugeSegment(new NSNumber(0), new NSNumber(100));
                segment.Fill     = new TKSolidFill(this.colors[i].ColorWithAlpha(0.4f));
                segment.Width    = 0.2f;
                segment.Width2   = 0.2f;
                segment.Location = i * 0.3f;
                segment.Cap      = TKGaugeSegmentCap.Round;
                scale.AddSegment(segment);

                TKGaugeSegment gradientSegment = new TKGaugeSegment();
                UIColor[]      colors          = new UIColor[] { this.colors[i], this.colors [i + 3] };
                gradientSegment.Fill     = new TKLinearGradientFill(colors, new CGPoint(0.0f, 0.0f), new CGPoint(1.0f, 1.0f));
                gradientSegment.Width    = 0.2f;
                gradientSegment.Width2   = 0.2f;
                gradientSegment.Location = i * 0.3f;
                gradientSegment.Cap      = TKGaugeSegmentCap.Round;
                scale.AddSegment(gradientSegment);

                gradientSegment.SetRange(new TKRange(new NSNumber(0), new NSNumber(20 + this.r.Next(50))), 0.5f, CAMediaTimingFunction.EaseInEaseOut);
            }
        }
コード例 #3
0
ファイル: GaugeCustomization.cs プロジェクト: tremors/ios-sdk
		void CreateRadialGauge()
		{
			this.radialGauge = new TKRadialGauge ();
			this.View.AddSubview (this.radialGauge);

			TKGaugeRadialScale scale = new TKGaugeRadialScale ();
			this.radialGauge.AddScale (scale);
			scale.StartAngle = 0;
			scale.EndAngle = (nfloat)Math.PI*2.0f;
			scale.Stroke = new TKStroke (UIColor.Clear);
			scale.Ticks.Hidden = true;
			scale.Labels.Hidden = true;

			for (int i=0; i < 3; i++) {
				TKGaugeSegment segment = new TKGaugeSegment (new NSNumber (0), new NSNumber (100));
				segment.Fill = new TKSolidFill(this.colors[i].ColorWithAlpha(0.4f));
				segment.Width = 0.2f;
				segment.Location = 0.5f + i * 0.25f;
				segment.Cap = TKGaugeSegmentCap.Round;
				scale.AddSegment(segment);

				TKGaugeSegment gradientSegment = new TKGaugeSegment ();
				UIColor[] colors = new UIColor[] { this.colors[i], this.colors [i + 3] };
				gradientSegment.Fill = new TKLinearGradientFill (colors, new CGPoint(0.0f, 0.0f), new CGPoint(1.0f, 1.0f));
				gradientSegment.Width = 0.2f;
				gradientSegment.Location = 0.5f + i * 0.25f;
				gradientSegment.Cap = TKGaugeSegmentCap.Round;
				scale.AddSegment (gradientSegment);
				gradientSegment.SetRange(new TKRange(new NSNumber(0), new NSNumber(20+ this.r.Next(50)) ), 0.5f, CAMediaTimingFunction.EaseInEaseOut);
			}
		}