当前位置: 首页>>代码示例>>C#>>正文


C# UIColor类代码示例

本文整理汇总了C#中UIColor的典型用法代码示例。如果您正苦于以下问题:C# UIColor类的具体用法?C# UIColor怎么用?C# UIColor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


UIColor类属于命名空间,在下文中一共展示了UIColor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GameboardView

		public GameboardView (int d,float width,float padding,float radius, UIColor backgroundColor, UIColor foregroundColor)
		{
			if (d > 0) {

			} else
				throw new Exception ();
		}
开发者ID:fadingflower,项目名称:Xamarin-2048,代码行数:7,代码来源:GameboardView.cs

示例2: WillFinishLaunching

		public virtual bool WillFinishLaunching (UIApplication application, MonoTouch.Foundation.NSDictionary launchOptions){
			UIViewController leftSideDrawerViewController = new MMExampleLeftSideDrawerViewController ();
			UIViewController centerViewController = new MMExampleCenterTableViewController ();
			UIViewController rightSideDrawerViewController = new UIViewController ();// new MMExampleRightSideDrawerViewController ();

			UINavigationController navigationController = new MMNavigationController ();
			navigationController.ViewControllers = new UIViewController[]{ centerViewController };
			navigationController.RestorationIdentifier = "MMExampleCenterNavigationControllerRestorationKey";

			UINavigationController leftSideNavController = new MMNavigationController ();
			leftSideNavController.ViewControllers = new UIViewController[]{ leftSideDrawerViewController };
			leftSideNavController.RestorationIdentifier = "MMExampleLeftNavigationControllerRestorationKey";

			this.DrawerController = new MMDrawerController.MMDrawerController ();
			DrawerController.CenterViewController = navigationController;
			DrawerController.LeftDrawerViewController = leftSideNavController;

			DrawerController.RestorationIdentifier = "MMDrawer";
			DrawerController.MaximumRightDrawerWidth = 200.0F;
			DrawerController.OpenDrawerGestureModeMask = MMOpenDrawerGestureMode.BezelPanningCenterView;
			DrawerController.CloseDrawerGestureModeMask = MMCloseDrawerGestureMode.BezelPanningCenterView;

			//DrawerController.DrawerVisualStateBlock = new Action (DrawerAction (DrawerController, new MMDrawerSide(), 100F));

			this.Window = new UIWindow (UIScreen.MainScreen.Bounds);
			UIColor tintColor = new UIColor (29.0F / 255.0F, 173.0F / 255.0F, 234.0F / 255.0F, 1.0F);
			this.Window.TintColor = tintColor;

			this.Window.RootViewController = this.DrawerController;

			return true;
		}
开发者ID:adlair,项目名称:MMDrawerController,代码行数:32,代码来源:AppDelegate.cs

示例3: CreateToolbarTextImageIcon

        public static UIView CreateToolbarTextImageIcon(string label, EventHandler action, UIImage iconImage, UIColor textColor, float width = 60)
        {
            float height = 30;
            float iconSize = 20;
            float iconMargin = 5;

            UILabel lb = new UILabel() {
                Font = UIFont.SystemFontOfSize(14),
                TextColor = textColor,
                Text = label,
                BackgroundColor = UIColor.Clear,
                TextAlignment = UITextAlignment.Left
            };
            lb.SizeToFit();
            int x = (int)(iconSize + (iconMargin * 2));
            int y = (int)((height - lb.Frame.Height) / 2);
            lb.Frame = new RectangleF (x, y, width-y, lb.Frame.Height);

            UIButton btn = new UIButton(UIButtonType.Custom);
            btn.Frame = new RectangleF(0, 0, width, height);
            if (action != null)
                btn.TouchUpInside += action;

            UIImageView iv = new UIImageView(iconImage);
            iv.Frame = new RectangleF(iconMargin, iconMargin, iconSize, iconSize);

            UIView container = new UIView(new RectangleF(0, 0, width, height));
            container.Add(iv);
            container.Add(btn);
            container.Add(lb);
            return container;
        }
开发者ID:rid00z,项目名称:Xamarin-iOS-SignatureStarterKit,代码行数:32,代码来源:Helper.cs

示例4: ViewDidLoad

		public override void ViewDidLoad(){
			this.TableView = new UITableView (this.View.Bounds, UITableViewStyle.Grouped);
			base.ViewDidLoad ();
			this.View.AddSubview (this.TableView);

			UITapGestureRecognizer doubleTap = new UITapGestureRecognizer ();
			doubleTap.NumberOfTapsRequired = 2;
			this.View.AddGestureRecognizer (doubleTap);

			UITapGestureRecognizer twoFingerDoubleTap = new UITapGestureRecognizer ();
			twoFingerDoubleTap.NumberOfTapsRequired = 2;
			twoFingerDoubleTap.NumberOfTouchesRequired = 2;
			this.View.AddGestureRecognizer (twoFingerDoubleTap);

			this.SetupLeftButton ();
			this.SetupRightButton ();

			UIColor barColor = new UIColor (247.0F / 255.0F, 249.0F / 255.0F, 250.0F / 255.0F, 1.0F);
			this.NavigationController.NavigationBar.BarTintColor = barColor;

			MMLogoView logo = new MMLogoView (new RectangleF (0F, 0F, 29F, 31F));
			this.NavigationItem.TitleView = logo;
			this.NavigationController.View.Layer.CornerRadius = 10.0F;

			UIView backView = new UIView ();
			backView.BackgroundColor = new UIColor (208.0F / 255.0F, 208.0F / 255.0F, 208.0F / 255.0F, 1.0F);
			this.TableView.BackgroundView = backView;
		}
开发者ID:adlair,项目名称:MMDrawerController,代码行数:28,代码来源:MMExampleCenterTableViewController.cs

示例5: GlassButton

 /// <summary>
 /// Creates a new instance of the GlassButton using the specified dimensions
 /// </summary>
 public GlassButton(RectangleF frame)
     : base(frame)
 {
     NormalColor = new UIColor (0.55f, 0.04f, 0.02f, 1);
     HighlightedColor = UIColor.Black;
     DisabledColor = UIColor.Gray;
 }
开发者ID:rajeshwarn,项目名称:GhostPractice-iPadRepo,代码行数:10,代码来源:GlassButton.cs

示例6: AddButton

            public string AddButton(string name, double left, double top, double width, double height, UIColor color, string command = "", string parent = "HUD/Overlay", string closeUi = "")
            {
                name = name + RandomString();

                ui.Add(new Dictionary<string, object> {
                    {"name", name},
                    {"parent", parent},
                    {"components",
                        new List<object> {
                            new Dictionary<string, string> {
                                {"type", "UnityEngine.UI.Button"},
                                {"close", closeUi},
                                {"command", command},
                                {"color", color.ToString()},
                                {"imagetype", "Tiled"}
                            },

                            new Dictionary<string, string> {
                                {"type", "RectTransform"},
                                {"anchormin", $"{left.ToString()} {((1 - top) - height).ToString()}"},
                                {"anchormax", $"{(left + width).ToString()} {(1 - top).ToString()}"}
                            }
                        }
                    }
                });

                objectList.Add(name);
                return name;
            }
开发者ID:LaserHydra,项目名称:Rust-UI-Builder,代码行数:29,代码来源:UIBuilder.cs

示例7: AddText

        public static UIImage AddText(this UIImage image, string text, PointF point, UIFont font, UIColor color, UITextAlignment alignment = UITextAlignment.Left)
        {
            //var labelRect = new RectangleF(point, new SizeF(image.Size.Width - point.X, image.Size.Height - point.Y));
            var h = text.StringHeight(font, image.Size.Width);
            var labelRect = new RectangleF(point, new SizeF(image.Size.Width - point.X, h));

            var label = new UILabel(labelRect)
            { 
                Font = font, 
                Text = text,
                TextColor = color,
                TextAlignment = alignment,
                BackgroundColor = UIColor.Clear
            };

            var labelImage = label.ToNativeImage();
            

            using (var context = image.Size.ToBitmapContext())
            {
                var rect = new RectangleF(new PointF(0, 0), image.Size);
                context.DrawImage(rect, image.CGImage);
                context.DrawImage(labelRect, labelImage.CGImage);
                context.StrokePath();
                return UIImage.FromImage(context.ToImage());
            }
        }
开发者ID:rid00z,项目名称:Xamarin-Forms-Labs,代码行数:27,代码来源:UIImageExtensions.cs

示例8: RefreshTableHeaderView

		public RefreshTableHeaderView (RectangleF rect) : base (rect)
		{
			this.AutoresizingMask = UIViewAutoresizing.FlexibleWidth;
			
			BackgroundColor = new UIColor (0.88f, 0.9f, 0.92f, 1);
			CreateViews ();
		}
开发者ID:jasonacox,项目名称:MonoTouch.Dialog,代码行数:7,代码来源:Controls.cs

示例9: ViewDidLoad

		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();
			TableView = new UITableView (this.View.Frame, UITableViewStyle.Grouped);
			TableView.Delegate = this.TableView.Delegate;
			TableView.DataSource = this.TableView.DataSource;
			this.View.AddSubview (this.TableView);
			TableView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;

			UIColor tableViewBackgroundColor = new UIColor (110.0F / 255.0F, 113.0F / 255.0F, 115.0F / 255.0F, 1.0F);
			UIColor barColor = new UIColor (161.0F / 255.0F, 164.0F / 255.0F, 166.0F / 255.0F, 1.0F);

			this.TableView.BackgroundColor = tableViewBackgroundColor;
			this.TableView.SeparatorStyle = UITableViewCellSeparatorStyle.None;
			this.View.BackgroundColor = new UIColor (161.0F / 255.0F, 164.0F / 255.0F, 166.0F / 255.0F, 1.0F);
			//if(this.NavigationController.NavigationBar RespondsToSelector(UIAppearance.SelectorAppearance)){
			this.NavigationController.NavigationBar.BarTintColor = barColor;

			UIColor titleColor = new UIColor (55.0F / 255.0F, 70.0F / 255.0F, 77.0F / 255.0F, 1.0F);

			this.NavigationController.NavigationBar.SetTitleTextAttributes (new UITextAttributes (){ TextColor = titleColor });

			this.DrawerWidths = NSArray.FromStrings (new string[] { "160", "200", "240", "280", "320" });
			SizeF logoSize = new SizeF (58F, 62F);
			MMLogoView logo = new MMLogoView (this.View.Frame);
			logo.Frame = new RectangleF (this.TableView.Bounds.GetMidX () - logoSize.Width / 2.0F, -logoSize.Height - logoSize.Height / 4.0F, logoSize.Width, logoSize.Height);
			logo.AutoresizingMask = UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleRightMargin;
			this.TableView.AddSubview (logo);
			this.View.BackgroundColor = UIColor.Clear;
		}
开发者ID:adlair,项目名称:MMDrawerController,代码行数:30,代码来源:MMExampleSideDrawerViewController.cs

示例10: Add

 public int Add(string title, UIColor color, Action action)
 {
     var index = AddButton (title);
     dict.Add (index, action);
     colors.Add(index,color);
     return index;
 }
开发者ID:nagyist,项目名称:iOSHelpers,代码行数:7,代码来源:SimpleAlertView.cs

示例11: ImageButton

		/// <summary>
		/// Creates a new instance of the ImageButton using the specified dimensions
		/// </summary>
		public ImageButton (RectangleF frame) : base (frame)
		{
			NormalColor = new UIColor (0.55f, 0.04f, 0.02f, 1);
			HighlightedColor = UIColor.Black;
			DisabledColor = UIColor.Gray;
			_DrawImage = false;
		}
开发者ID:21Off,项目名称:21Off,代码行数:10,代码来源:ImageButton.cs

示例12: ButtonImage

		public static UIImage ButtonImage (UIColor color, float cornerRadius, UIColor shadowColor, UIEdgeInsets shadowInsets)
		{

			UIImage topImage = ImageWithColor (color, cornerRadius);
			UIImage bottomImage = ImageWithColor (shadowColor, cornerRadius);

			float totalHeight = EdgeSizeFromCornerRadius (cornerRadius) + shadowInsets.Top + shadowInsets.Bottom;
			float totalWidth = EdgeSizeFromCornerRadius (cornerRadius) + shadowInsets.Left + shadowInsets.Right;
			float topWidth = EdgeSizeFromCornerRadius (cornerRadius);
			float topHeight = EdgeSizeFromCornerRadius (cornerRadius);
			RectangleF topRect = new RectangleF (shadowInsets.Left, shadowInsets.Top, topWidth, topHeight);
			RectangleF bottomRect = new RectangleF (0, 0, totalWidth, totalHeight);

			UIGraphics.BeginImageContextWithOptions (new SizeF (totalWidth, totalHeight), false, 0.0f);

			if (!RectangleF.Equals (bottomRect, topRect)) {
				bottomImage.Draw (bottomRect);
			}
			topImage.Draw (topRect);

			UIImage buttonImage = UIGraphics.GetImageFromCurrentImageContext ();
			UIGraphics.EndImageContext ();
			UIEdgeInsets resizeableInsets = new UIEdgeInsets (cornerRadius + shadowInsets.Top,
			                                                  cornerRadius + shadowInsets.Left,
			                                                  cornerRadius + shadowInsets.Bottom,
			                                                  cornerRadius + shadowInsets.Right);
			return buttonImage.CreateResizableImage (resizeableInsets);
		}
开发者ID:JackWangCUMT,项目名称:FlatUI.iOS,代码行数:28,代码来源:ImageHelper.cs

示例13: ToUIColor

		public static UIColor ToUIColor(this Color sourceColor)
		{
			UIColor uiColor = new UIColor();
			Type UIColorType = typeof(UIColor);
			var color = UIColorType.GetProperties().SingleOrDefault((p)=>p.Name == sourceColor.ToString());
			return color.GetValue(uiColor, null) as UIColor;
		}
开发者ID:briandonahue,项目名称:MonoTouch.MVVM,代码行数:7,代码来源:Color.cs

示例14: LoadMoreElement

		public LoadMoreElement (string normalCaption, string loadingCaption, Action<LoadMoreElement> tapped, UIFont font, UIColor textColor) : base ("")
		{
			this.NormalCaption = normalCaption;
			this.LoadingCaption = loadingCaption;
			this.tapped = tapped;
			this.font = font;
			
			cell = new UITableViewCell (UITableViewCellStyle.Default, "loadMoreElement");
			
			activityIndicator = new UIActivityIndicatorView () {
				ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.Gray,
				Hidden = true
			};
			activityIndicator.StopAnimating ();
			
			caption = new UILabel () {
				Font = font,
				Text = this.NormalCaption,
				TextColor = textColor,
				BackgroundColor = UIColor.Clear,
				TextAlignment = UITextAlignment.Center,
				AdjustsFontSizeToFitWidth = false,
			};
			
			Layout ();
			
			cell.ContentView.AddSubview (caption);
			cell.ContentView.AddSubview (activityIndicator);
		}
开发者ID:jogibear9988,项目名称:MonoTouch.Dialog,代码行数:29,代码来源:LoadMoreElement.cs

示例15: RoundedRectView

		/// <summary>
		/// Initializes a new instance of the <see cref="RoundedRectView"/> class.
		/// </summary>
		/// <param name='rect'>Rectangle of the view</param>
		/// <param name='oBackgroundColor'>background color</param>
		/// <param name='eCornerFlags'>rounded corners</param>
		public RoundedRectView (RectangleF rect, UIColor oBackgroundColor, UIRectCorner eCornerFlags) : base(rect)
		{
			this.fCornerRadius = CORNER_RADIUS;
			this.eRoundedCorners = eCornerFlags;
			this.BackgroundColor = oBackgroundColor;
			this.UpdateMask();
		}
开发者ID:bpug,项目名称:LbkIos,代码行数:13,代码来源:RoundedRectView.cs


注:本文中的UIColor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。