當前位置: 首頁>>代碼示例>>C#>>正文


C# UIKit.UIColor類代碼示例

本文整理匯總了C#中UIKit.UIColor的典型用法代碼示例。如果您正苦於以下問題:C# UIColor類的具體用法?C# UIColor怎麽用?C# UIColor使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


UIColor類屬於UIKit命名空間,在下文中一共展示了UIColor類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: CreateLinearGauge

		void CreateLinearGauge()
		{
			this.linearGauge = new TKLinearGauge();
			this.linearGauge.WeakDelegate = this.gaugeDelegate;
			this.linearGauge.Orientation = TKLinearGaugeOrientation.Vertical;
			this.View.AddSubview(this.linearGauge);

			TKGaugeLinearScale scale = new TKGaugeLinearScale (new NSNumber(-10), new NSNumber(40));	
			this.linearGauge.AddScale (scale);

			TKGaugeSegment segment = new TKGaugeSegment (new NSNumber(-10), new NSNumber(18));
			segment.Location = 0.56f;
			segment.Width = 0.05f;
			segment.Width2 = 0.05f;
			segment.Cap = TKGaugeSegmentCap.Round;

			scale.AddSegment (segment);

			UIColor[] colors = new UIColor[] { 
				new UIColor (0.149f, 0.580f, 0.776f, 1.00f),
				new UIColor (0.537f, 0.796f, 0.290f, 1.00f),
				new UIColor (1.000f, 0.773f, 0.247f, 1.00f),
				new UIColor (1.000f, 0.463f, 0.157f, 1.00f),
				new UIColor (0.769f, 0.000f, 0.047f, 1.00f)
			};
			this.AddSegments(scale, colors, 0.5f, 0.05f);
		}
開發者ID:tremors,項目名稱:ios-sdk,代碼行數:27,代碼來源:GaugeGettingStarted.cs

示例2: FAButton

		/// <summary>
		/// Initializes a new instance of the <see cref="FontAwesomeXamarin.FAButton"/> class.
		/// This class extends UIButton. It does set set a default Frame. You must do this yourself
		/// </summary>
		/// <param name="icon">Icon.</param>
		/// <param name="fontColor">Font color.</param>
		/// <param name="iconSize">Icon size.</param>
		public FAButton (string icon, UIColor fontColor, float iconSize = 20) : base(UIButtonType.System)
		{
			Icon = icon;
			IconSize = iconSize;
			this.SetTitleColor (fontColor, UIControlState.Normal);
			this.SetTitleColor (fontColor.ColorWithAlpha(100), UIControlState.Highlighted);
		}
開發者ID:wnf0000,項目名稱:FontAwesome.Xamarin,代碼行數:14,代碼來源:FAButton.cs

示例3: AddBorder

		public static void AddBorder(this UIView view, UIRectEdge edge, UIColor color, nfloat thickness) {

			var border = new CALayer ();
			var f = view.Frame;
			switch(edge)
			{
			case UIRectEdge.Top:
				border.Frame = new CGRect(0, 0, f.Width, thickness);
				break;
			case UIRectEdge.Bottom:
				border.Frame = new CGRect (0, f.Height - thickness, f.Width, thickness);
				break;
			case UIRectEdge.Left:
				border.Frame = new CGRect(0, 0, thickness, f.Height);
				break;
			case UIRectEdge.Right:
				border.Frame = new CGRect(f.Width - thickness, 0, thickness, f.Height);
				break;
			default:
				break;
			}

			border.BackgroundColor = color.CGColor;
			view.Layer.AddSublayer (border);
		}
開發者ID:ddomengeaux,項目名稱:xamarin-amccorma,代碼行數:25,代碼來源:UIViewExtensions.cs

示例4: SetCornerBackgroundColor

 public void SetCornerBackgroundColor(UIColor color)
 {
     if (color != CornerBackgroundColor) {
         CornerBackgroundColor = color;
         SetNeedsDisplay();
     }
 }
開發者ID:pazof,項目名稱:MonoCross,代碼行數:7,代碼來源:MGCornersView.cs

示例5: Create

        public static FavoriteNodeView Create (CGRect frame, NodeViewController nodeViewController, UIColor kleur)
        {
            var view = (FavoriteNodeView)Nib.Instantiate (null, null) [0];
            view.Frame = frame;
            view.SetShadow();
            view._nodeViewController = nodeViewController;
            view.NodeItemTableController.RefreshControl = new UIRefreshControl()
            {
                TintColor = UIColor.FromRGB(143, 202, 232),
                AttributedTitle = new NSAttributedString("Map aan het verversen")
            };

            view.NodeItemTableController.RefreshControl.ValueChanged += delegate
            {
                view.Refresh();
            };

            view.SyncButton.TouchUpInside += delegate
            {;
                view.Refresh(scrollToTop: true);
            };

            if (kleur != null)
            {
                view.KleurenBalk.BackgroundColor = kleur;
            }
                
            view.Refresh(scrollToTop: true);
            return view;
        }
開發者ID:MBrekhof,項目名稱:pleiobox-clients,代碼行數:30,代碼來源:FavoriteNodeView.cs

示例6: CellDisclosureAccessory

 public CellDisclosureAccessory(CGRect frame)
     : base(frame)
 {
     this.BackgroundColor = UIColor.Clear;
     this.color = App.ForegroundColor.ToUIColor();
     this.highlightedColor = App.NavigationColor.ToUIColor();
 }
開發者ID:reactiveui-forks,項目名稱:WorkoutWotch,代碼行數:7,代碼來源:CellDisclosureAccessory.cs

示例7: Create

        public static BaseItemView Create (CGRect frame, NodeViewController nodeViewController, TreeNode node, string filePath, UIColor kleur)
        {
            var view = BaseItemView.Create(frame, nodeViewController, node, kleur);
            UIWebView webView = new UIWebView();

			string extension = Path.GetExtension (filePath);
			if (extension == ".odt") {
				string viewerPath = NSBundle.MainBundle.PathForResource ("over/viewer/index", "html");

				Uri fromUri = new Uri(viewerPath);
				Uri toUri = new Uri(filePath);
				Uri relativeUri = fromUri.MakeRelativeUri(toUri);
				String relativePath = Uri.UnescapeDataString(relativeUri.ToString());

				NSUrl finalUrl = new NSUrl ("#" + relativePath.Replace(" ", "%20"), new NSUrl(viewerPath, false));
				webView.LoadRequest(new NSUrlRequest(finalUrl));
				webView.ScalesPageToFit = true;
				view.ContentView = webView;

				return view;
			} else {
				NSUrl finalUrl = new NSUrl (filePath, false);
				webView.LoadRequest(new NSUrlRequest(finalUrl));
				webView.ScalesPageToFit = true;
				view.ContentView = webView;

				return view;
			}
		
        }
開發者ID:MBrekhof,項目名稱:pleiobox-clients,代碼行數:30,代碼來源:WebItemView.cs

示例8: CreateRadialGauge

		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);
			}
		}
開發者ID:tremors,項目名稱:ios-sdk,代碼行數:31,代碼來源:GaugeCustomization.cs

示例9: ImageFromFont

        public static UIImage ImageFromFont(string text, UIColor iconColor, CGSize iconSize, string fontName)
        {
            UIGraphics.BeginImageContextWithOptions(iconSize, false, 0);

              var textRect = new CGRect(CGPoint.Empty, iconSize);
              var path = UIBezierPath.FromRect(textRect);
              UIColor.Clear.SetFill();
              path.Fill();

              var font = UIFont.FromName(fontName, iconSize.Width);
              using (var label = new UILabel() { Text = text, Font = font })
              {
            GetFontSize(label, iconSize, 500, 5);
            font = label.Font;
              }
              iconColor.SetFill();
              using (var nativeString = new NSString(text))
              {
            nativeString.DrawString(textRect, new UIStringAttributes
              {
            Font = font,
            ForegroundColor = iconColor,
            BackgroundColor = UIColor.Clear,
            ParagraphStyle = new NSMutableParagraphStyle
            {
              Alignment = UITextAlignment.Center
            }
              });
              }
              var image = UIGraphics.GetImageFromCurrentImageContext();
              UIGraphics.EndImageContext();
              image = image.ImageWithRenderingMode (UIImageRenderingMode.AlwaysOriginal);
              return image;
        }
開發者ID:anthonylowther21,項目名稱:DebtCalculator,代碼行數:34,代碼來源:FontAwesomeImageHelper.cs

示例10: GlassButton

 /// <summary>
 /// Creates a new instance of the GlassButton using the specified dimensions
 /// </summary>
 public GlassButton(CGRect frame)
     : base(frame)
 {
     NormalColor = new UIColor(0.55f, 0.04f, 0.02f, 1);
     HighlightedColor = UIColor.Black;
     DisabledColor = UIColor.Gray;
 }
開發者ID:acejack987,項目名稱:CivicaGlossaryIOSApp,代碼行數:10,代碼來源:GlassButton.cs

示例11: ToUIColorOrDefault

        /// <summary>
        /// Converts the UIColor to a Xamarin Color object.
        /// </summary>
        /// <param name="color">The color.</param>
        /// <param name="defaultColor">The default color.</param>
        /// <returns>UIColor.</returns>
        public static UIColor ToUIColorOrDefault(this Xamarin.Forms.Color color, UIColor defaultColor)
        {
            if (color == Xamarin.Forms.Color.Default)
                return defaultColor;

            return color.ToUIColor();
        }
開發者ID:robertohuertasm,項目名稱:Xamarin-Forms-Labs,代碼行數:13,代碼來源:ColorExtensions.cs

示例12: TabControl

 public TabControl(CGRect frame, UIColor selectedTabColor, UIColor unselectedTabColor)
 {
     this.unselectedTabColor = unselectedTabColor;
     this.selectedTabColor = selectedTabColor;
     this.items = new List<TabControlItem>();
     this.Frame = frame;
 }
開發者ID:Immons,項目名稱:XamarinHelper,代碼行數:7,代碼來源:TabControl.cs

示例13: CalloutAnnotation

        public CalloutAnnotation(int count, CGRect rect, nfloat lineWidth, UIColor color)
        {
            Path = UIBezierPath.FromOval(rect);
            Path.LineWidth = lineWidth;

            var center = new CGPoint (rect.GetMidX(), rect.GetMidY());

            Center = center;

            nfloat startAngle = (nfloat)(Math.PI * 0.75);
            nfloat endAngle = (nfloat)(Math.PI * 0.60);

            Clip = UIBezierPath.FromArc(center, center.X + lineWidth, startAngle, endAngle, true);
            Clip.AddLineTo(center);
            Clip.ClosePath();
            Clip.LineWidth = lineWidth;

            Tail = new UIBezierPath ();
            Tail.MoveTo(new CGPoint (center.X - 11, center.Y + 9));
            Tail.AddLineTo(new CGPoint (center.X - 11, center.Y + 18));
            Tail.AddLineTo(new CGPoint (center.X - 3, center.Y + 13));
            Tail.LineWidth = lineWidth;

            Rect = rect;
            Color = color;
            Count = count;
        }
開發者ID:colbylwilliams,項目名稱:bugtrap,代碼行數:27,代碼來源:CalloutAnnotation.cs

示例14: ToUIColor

		public static UIColor ToUIColor(this Color color, UIColor defaultColor)
		{
			if (color.IsDefault)
				return defaultColor;

			return color.ToUIColor();
		}
開發者ID:Costo,項目名稱:Xamarin.Forms,代碼行數:7,代碼來源:ColorExtensions.cs

示例15: CreateAttributedStringFromBlocks

        private static Tuple<NSMutableAttributedString,List<NewsCellView.Link>> CreateAttributedStringFromBlocks(UIFont font, UIColor primaryColor, IEnumerable<TextBlock> blocks)
        {
            var attributedString = new NSMutableAttributedString();
            var links = new List<NewsCellView.Link>();

            nint lengthCounter = 0;
            int i = 0;

            foreach (var b in blocks)
            {
                UIColor color = null;
                if (b.Tapped != null)
                    color = LinkColor;

                color = color ?? primaryColor; 

                var ctFont = new CoreText.CTFont(font.Name, font.PointSize);
                var str = new NSAttributedString(b.Value, new CoreText.CTStringAttributes() { ForegroundColor = color.CGColor, Font = ctFont });
                attributedString.Append(str);
                var strLength = str.Length;

                if (b.Tapped != null)
                {
                    var weakTapped = new WeakReference<Action>(b.Tapped);
                    links.Add(new NewsCellView.Link { Range = new NSRange(lengthCounter, strLength), Callback = () => weakTapped.Get()?.Invoke(), Id = i++ });
                }

                lengthCounter += strLength;
            }

            return new Tuple<NSMutableAttributedString, List<NewsCellView.Link>>(attributedString, links);
        }
開發者ID:xNUTs,項目名稱:CodeBucket,代碼行數:32,代碼來源:NewsFeedElement.cs


注:本文中的UIKit.UIColor類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。