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


C# UIButton.SetTitleColor方法代码示例

本文整理汇总了C#中UIButton.SetTitleColor方法的典型用法代码示例。如果您正苦于以下问题:C# UIButton.SetTitleColor方法的具体用法?C# UIButton.SetTitleColor怎么用?C# UIButton.SetTitleColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UIButton的用法示例。


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

示例1: SelectorButton

 public static void SelectorButton (UIButton v)
 {
     v.Font = UIFont.FromName ("HelveticaNeue-Thin", 18f);
     v.LineBreakMode = UILineBreakMode.Clip;
     v.SetTitleColor (Color.Black, UIControlState.Normal);
     v.SetTitleColor (Color.Gray, UIControlState.Highlighted);
 }
开发者ID:VDBBjorn,项目名称:toggl_mobile,代码行数:7,代码来源:Style.ReportsView.cs

示例2: AddSiteUrl

		public void AddSiteUrl(RectangleF frame)
		{
			url = UIButton.FromType(UIButtonType.Custom);
			url.LineBreakMode = UILineBreakMode.TailTruncation;
			url.HorizontalAlignment = UIControlContentHorizontalAlignment.Left;
			url.TitleShadowOffset = new SizeF(0, 1);
			url.SetTitleColor(UIColor.FromRGB (0x32, 0x4f, 0x85), UIControlState.Normal);
			url.SetTitleColor(UIColor.Red, UIControlState.Highlighted);
			url.SetTitleShadowColor(UIColor.White, UIControlState.Normal);
			url.AddTarget(delegate { if (UrlTapped != null) UrlTapped (); }, UIControlEvent.TouchUpInside);
			
			// Autosize the bio URL to fit available space
			var size = _urlSize;
			var urlFont = UIFont.BoldSystemFontOfSize(size);
			var urlSize = new NSString(_bio.Url).StringSize(urlFont);
			var available = Util.IsPad() ? 400 : 185; // Util.IsRetina() ? 185 : 250;		
			while(urlSize.Width > available)
			{
				urlFont = UIFont.BoldSystemFontOfSize(size--);
				urlSize = new NSString(_bio.Url).StringSize(urlFont);
			}
			
			url.Font = urlFont;			
			url.Frame = new RectangleF ((float)_left, (float)70, (float)(frame.Width - _left), (float)size);
			url.SetTitle(_bio.Url, UIControlState.Normal);
			url.SetTitle(_bio.Url, UIControlState.Highlighted);			
			AddSubview(url);
		}
开发者ID:modulexcite,项目名称:artapp,代码行数:28,代码来源:BioView.cs

示例3: ViewDidLoad

        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            _tipLabel = new UILabel ();
            _calculateButton = new UIButton (UIButtonType.Custom);
            _priceField = new UITextField ();
            _tipPercentages = new UISegmentedControl ();

            View.AddSubview (_priceField);
            View.AddSubview (_calculateButton);
            View.AddSubview (_tipLabel);
            View.AddSubview (_tipPercentages);

            _priceField.TranslatesAutoresizingMaskIntoConstraints = false;
            _priceField.KeyboardType = UIKeyboardType.DecimalPad;
            _priceField.BorderStyle = UITextBorderStyle.RoundedRect;
            _priceField.Placeholder = "Enter Total Amount:";

            View.AddConstraint (NSLayoutConstraint.Create (View, NSLayoutAttribute.Top, NSLayoutRelation.Equal, _priceField, NSLayoutAttribute.TopMargin, 1, -28));
            View.AddConstraint (NSLayoutConstraint.Create (View, NSLayoutAttribute.CenterX, NSLayoutRelation.Equal, _priceField, NSLayoutAttribute.CenterX, 1, 0));
            View.AddConstraint (NSLayoutConstraint.Create (View, NSLayoutAttribute.Width, NSLayoutRelation.Equal, _priceField, NSLayoutAttribute.Width, 1, 40));
            View.AddConstraint (NSLayoutConstraint.Create (_priceField, NSLayoutAttribute.Height, NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 1, 35));

            _calculateButton.TranslatesAutoresizingMaskIntoConstraints = false;
            _calculateButton.SetTitle ("Calculate", UIControlState.Normal);
            _calculateButton.SetTitleColor (UIColor.White, UIControlState.Normal);
            _calculateButton.SetTitleColor (UIColor.Blue, UIControlState.Highlighted);
            _calculateButton.BackgroundColor = UIColor.Green;
            _calculateButton.TouchUpInside += (sender, e) => CalculateCurrentTip();

            View.AddConstraint(NSLayoutConstraint.Create(_priceField, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, _calculateButton, NSLayoutAttribute.Top, 1, -8));
            View.AddConstraint (NSLayoutConstraint.Create (_calculateButton, NSLayoutAttribute.CenterX, NSLayoutRelation.Equal, View, NSLayoutAttribute.CenterX, 1, 0));
            View.AddConstraint (NSLayoutConstraint.Create (_calculateButton, NSLayoutAttribute.Width, NSLayoutRelation.Equal, View, NSLayoutAttribute.Width, 1, -40));

            _tipPercentages.TranslatesAutoresizingMaskIntoConstraints = false;
            _tipPercentages.InsertSegment ("10%", 0, false);
            _tipPercentages.InsertSegment ("15%", 1, false);
            _tipPercentages.InsertSegment ("20%", 2, false);
            _tipPercentages.InsertSegment ("25%", 3, false);
            _tipPercentages.SelectedSegment = 2;
            _tipPercentages.ValueChanged += (sender, e) => CalculateCurrentTip();

            View.AddConstraint (NSLayoutConstraint.Create (_calculateButton, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, _tipPercentages, NSLayoutAttribute.Top, 1, -8));
            View.AddConstraint (NSLayoutConstraint.Create (_tipPercentages, NSLayoutAttribute.Width, NSLayoutRelation.Equal, View, NSLayoutAttribute.Width, 1, -40));
            View.AddConstraint (NSLayoutConstraint.Create (_tipPercentages, NSLayoutAttribute.CenterX, NSLayoutRelation.Equal, View, NSLayoutAttribute.CenterX, 1, 0));

            _tipLabel.TranslatesAutoresizingMaskIntoConstraints = false;
            _tipLabel.TextColor = UIColor.Blue;
            _tipLabel.Text = string.Format (TipFormat, 0);
            _tipLabel.TextAlignment = UITextAlignment.Center;

            View.AddConstraint (NSLayoutConstraint.Create (_tipLabel, NSLayoutAttribute.Top, NSLayoutRelation.Equal, _tipPercentages, NSLayoutAttribute.Bottom, 1, 8));
            View.AddConstraint (NSLayoutConstraint.Create (_tipLabel, NSLayoutAttribute.Width, NSLayoutRelation.Equal, View, NSLayoutAttribute.Width, 1, -40));
            View.AddConstraint (NSLayoutConstraint.Create (_tipLabel, NSLayoutAttribute.CenterX, NSLayoutRelation.Equal, View, NSLayoutAttribute.CenterX, 1, 0));

            View.BackgroundColor = UIColor.Yellow;
            View.AddGestureRecognizer (new UITapGestureRecognizer (() => _priceField.ResignFirstResponder ()));
        }
开发者ID:dylansturg,项目名称:XamarinUniversitySamples,代码行数:59,代码来源:TipCalculatorViewController.cs

示例4: GetViewForHeader

        public override UIView GetViewForHeader(UITableView tableView, nint section)
        {
            if (section == 0) {
                var view = new UIView (new CGRect (0, 0, UIScreen.MainScreen.ApplicationFrame.Width, 80));
                view.BackgroundColor = UIColor.FromRGB(13, 146, 198);

                var containerView = new UIView (new CGRect (0, 0, UIScreen.MainScreen.ApplicationFrame.Width, 90));
                containerView.AddSubview (view);

                var foodImageView = new UIButton (UIButtonType.Custom);
                foodImageView.SetImage (UIImage.FromFile ("food.png"), UIControlState.Normal);
                foodImageView.SetTitle ("Food", UIControlState.Normal);
                foodImageView.SetTitleColor (UIColor.White, UIControlState.Normal);
                foodImageView.SetTitleColor (UIColor.Gray, UIControlState.Highlighted);
                foodImageView.ImageEdgeInsets = new UIEdgeInsets (-25, 5, 0, 0);
                foodImageView.TitleEdgeInsets = new UIEdgeInsets (30, -36, 0, 0);
                foodImageView.TitleLabel.TextAlignment = UITextAlignment.Center;
                foodImageView.Frame = new CGRect (10, 10, 50, 60);
                containerView.AddSubview (foodImageView);

                var firmImageView = new UIButton (UIButtonType.Custom);
                firmImageView.SetImage (UIImage.FromFile ("firm.png"), UIControlState.Normal);
                firmImageView.SetTitle ("Firm", UIControlState.Normal);
                firmImageView.SetTitleColor (UIColor.White, UIControlState.Normal);
                firmImageView.SetTitleColor (UIColor.Gray, UIControlState.Highlighted);
                firmImageView.ImageEdgeInsets = new UIEdgeInsets (-25, 5, 0, 0);
                firmImageView.TitleEdgeInsets = new UIEdgeInsets (30, -36, 0, 0);
                firmImageView.TitleLabel.TextAlignment = UITextAlignment.Center;
                firmImageView.Frame = new CGRect (90, 10, 50, 60);
                containerView.AddSubview (firmImageView);

                var hotelImageView = new UIButton (UIButtonType.Custom);
                hotelImageView.SetImage (UIImage.FromFile ("hotel.png"), UIControlState.Normal);
                hotelImageView.SetTitle ("Hotel", UIControlState.Normal);
                hotelImageView.SetTitleColor (UIColor.White, UIControlState.Normal);
                hotelImageView.SetTitleColor (UIColor.Gray, UIControlState.Highlighted);
                hotelImageView.ImageEdgeInsets = new UIEdgeInsets (-25, 5, 0, 0);
                hotelImageView.TitleEdgeInsets = new UIEdgeInsets (30, -36, 0, 0);
                hotelImageView.TitleLabel.TextAlignment = UITextAlignment.Center;
                hotelImageView.Frame = new CGRect (170, 10, 50, 60);
                containerView.AddSubview (hotelImageView);

                var voiceImageView = new UIButton (UIButtonType.Custom);
                voiceImageView.SetImage (UIImage.FromFile ("voice.png"), UIControlState.Normal);
                voiceImageView.SetTitle ("Voice", UIControlState.Normal);
                voiceImageView.SetTitleColor (UIColor.White, UIControlState.Normal);
                voiceImageView.SetTitleColor (UIColor.Gray, UIControlState.Highlighted);
                voiceImageView.ImageEdgeInsets = new UIEdgeInsets (-25, 5, 0, 0);
                voiceImageView.TitleEdgeInsets = new UIEdgeInsets (30, -36, 0, 0);
                voiceImageView.TitleLabel.TextAlignment = UITextAlignment.Center;
                voiceImageView.Frame = new CGRect (250, 10, 50, 60);
                containerView.AddSubview (voiceImageView);

                return containerView;
            }

            return base.GetViewForHeader (tableView, section);
        }
开发者ID:oldmyezi,项目名称:dendrobiiwine,代码行数:58,代码来源:MainViewController.cs

示例5: ViewDidLoad

        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();
            View.BackgroundColor = UIColor.DarkGray;

            passAvailable = new UITextView (new RectangleF (20, 100, 300, 200));
            passAvailable.Font = UIFont.SystemFontOfSize(14f);
            passAvailable.BackgroundColor = UIColor.Clear;
            passAvailable.TextColor = UIColor.White;
            passAvailable.Editable = false;
            Add (passAvailable);

            var topOfButton = View.Frame.Height - 160;
            showPass = UIButton.FromType (UIButtonType.Custom);
            showPass.Frame = new RectangleF(60, topOfButton, 200, 40);
            showPass.Layer.CornerRadius = 7f;
            showPass.Layer.MasksToBounds = true;
            showPass.Layer.BorderColor = new MonoTouch.CoreGraphics.CGColor(0.8f, 1.0f);
            showPass.Layer.BorderWidth = 1;
            showPass.SetTitle ("Open in Passbook", UIControlState.Normal);
            showPass.BackgroundColor = UIColor.DarkGray;
            showPass.SetTitleColor(UIColor.White, UIControlState.Normal);
            showPass.SetTitleShadowColor (UIColor.Black, UIControlState.Normal);
            showPass.TitleShadowOffset = new SizeF(1,1);
            showPass.SetTitleColor(UIColor.LightGray, UIControlState.Highlighted);

            showPass.TouchUpInside += (sender, e) => {
                UIApplication.SharedApplication.OpenUrl (currentPass.PassUrl);
            };
            Add (showPass);

            passHeading = new UILabel (new RectangleF (10, 40, 310, 80));
            passHeading.Text = "No Event Ticket\nin Passbook";
            passHeading.Lines = 2;
            passHeading.TextAlignment = UITextAlignment.Center;
            passHeading.Font = UIFont.SystemFontOfSize(24f);
            passHeading.BackgroundColor = UIColor.Clear;
            passHeading.TextColor = UIColor.White;
            passHeading.ShadowColor= UIColor.Black;
            passHeading.ShadowOffset = new SizeF(1,1);
            Add (passHeading);

            passImage = new UIImageView (new RectangleF(90,120,147,186));
            passImage.Image = UIImage.FromBundle("Images/NoTicketSlash");
            Add (passImage);

            library = new PKPassLibrary ();
            noteCenter = NSNotificationCenter.DefaultCenter.AddObserver (PKPassLibrary.DidChangeNotification, (not) => {
                BeginInvokeOnMainThread (() => {
                    // refresh the pass
                    passes = library.GetPasses ();
                    RenderPass(passes);
                });
            }, library);  // IMPORTANT: must pass the library in

            passes = library.GetPasses ();
            RenderPass(passes);
        }
开发者ID:shaneprice,项目名称:MonkeySpace,代码行数:58,代码来源:PassKitViewController.cs

示例6: Style

			public static void Style(UIButton reserve)
			{
				reserve.SetTitleColor(Application.ThemeColors.ButtonDisabledTextColor, UIControlState.Disabled);
				reserve.SetTitleColor(Application.ThemeColors.ButtonTextColor, UIControlState.Normal);
				reserve.SetTitleColor(Application.ThemeColors.ButtonTextColor.ColorWithAlpha(0.5f), UIControlState.Selected);
				reserve.SetTitleColor(Application.ThemeColors.ButtonTextColor.ColorWithAlpha(0.5f), UIControlState.Highlighted);
				reserve.Font = Application.ThemeColors.ButtonFont;
				reserve.BackgroundColor = Application.ThemeColors.ButtonBackground;
			}
开发者ID:khellang,项目名称:Solvberget,代码行数:9,代码来源:Main.cs

示例7: LayoutSubviews

        public override void LayoutSubviews()
        {
            //ContentView 
            contentScrollView = new UIScrollView();
            contentScrollView.Frame = new CoreGraphics.CGRect(0, tabbarHeight, Bounds.Width, Bounds.Height - tabbarHeight - 98);
            contentScrollView.BackgroundColor = ContentBackgroundColor;
            contentScrollView.PagingEnabled = true;

            //tabbar 
            tabbarBackground.BackgroundColor = TabbarBackgroundColor;
            tabbarBackground.Frame = new CoreGraphics.CGRect(0, 0, Bounds.Width, tabbarHeight);

            nfloat tabbuttonWidth = 0;
            foreach (var viewController in ViewControllers)
            {
                var index = ViewControllers.IndexOf(viewController);

                var button = new UIButton(UIButtonType.RoundedRect);
                button.Tag = index;
                button.SetTitle(viewController.Title, UIControlState.Normal);
                button.Font = Helpers.Style.Fonts.ScrollTabbarTitle;

                if(index == 0)
                    button.SetTitleColor(SelectedTabTextColor, UIControlState.Normal);
                else
                    button.SetTitleColor(TabTextColor, UIControlState.Normal);

                tabbuttonWidth = Bounds.Width / ViewControllers.Count +1;
                button.Frame = new CoreGraphics.CGRect(tabbuttonWidth * index, 2, tabbuttonWidth, tabbarHeight - 4);
                button.TouchUpInside += delegate 
                {
                    CurrentIndex = index;
                    TabItemSelected(index);
                    ResignFirstResponder();
                };

                tabbarBackground.AddSubview(button);
                viewController.View.Frame = new CGRect(Bounds.Width * index, 0, Bounds.Width, contentScrollView.Frame.Height);

                contentScrollView.AddSubview(viewController.View);
            }

            contentScrollView.ContentSize = new CGSize(Bounds.Width * ViewControllers.Count, 400);
            contentScrollView.Scrolled += ContentScrolled;

            //Underline 
            selectedTabUnderlineView = new UIView();
            selectedTabUnderlineView.BackgroundColor = SelectedTabUnderlineColor;
            selectedTabUnderlineView.Frame = new CGRect(0, tabbarHeight - 4, tabbuttonWidth, 4);
                       
            //Add views
            AddSubview(contentScrollView);
            AddSubview(tabbarBackground);
            AddSubview(selectedTabUnderlineView);
        }
开发者ID:MikeCodesDotNet,项目名称:Beer-Drinkin,代码行数:55,代码来源:ScrollingTabView.cs

示例8: StopButton

 public static void StopButton (UIButton v)
 {
     v.Font = UIFont.FromName ("HelveticaNeue-Light", 16f);
     v.SetBackgroundImage (Image.CircleStop, UIControlState.Normal);
     v.SetBackgroundImage (Image.CircleStopPressed, UIControlState.Highlighted);
     v.SetTitleColor (Color.Red, UIControlState.Normal);
     v.SetTitleColor (Color.White, UIControlState.Highlighted);
     v.SetTitle ("NavTimerStop".Tr (), UIControlState.Normal);
     // TODO: Remove this scale workaround
     v.Transform = MonoTouch.CoreGraphics.CGAffineTransform.MakeScale (0.7f, 0.7f);
 }
开发者ID:jblj,项目名称:mobile,代码行数:11,代码来源:Style.NavTimer.cs

示例9: ViewDidLoad

        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            if (RespondsToSelector(new Selector("edgesForExtendedLayout")))
                EdgesForExtendedLayout = UIRectEdge.None;

            var source = new MvxStandardTableViewSource(TableView, UITableViewCellStyle.Subtitle, new NSString("sub"), "TitleText PriceText;ImageUrl ImageUri;DetailText DetailsText", UITableViewCellAccessory.DisclosureIndicator);
            TableView.Source = source;

            var set = this.CreateBindingSet<SearchResultsView, SearchResultsViewModel>();
            set.Bind(source).To(vm => vm.Properties);
            set.Bind(source).For(s => s.SelectionChangedCommand).To(vm => vm.PropertiesSelectedCommand);
            set.Bind(this).For(s => s.Title).To(vm => vm.Title);
            var myFooter = new UIView(new RectangleF(0, 0, 320, 40));

            UIButton loadMoreButton = new UIButton(new RectangleF(0, 0, 320, 40));
            loadMoreButton.SetTitle("Load More", UIControlState.Normal);
            loadMoreButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            set.Bind(loadMoreButton).To(vm => vm.LoadMoreCommand);
            set.Bind(loadMoreButton).For("Title").To(vm => vm.Title);

            myFooter.Add(loadMoreButton);

            TableView.TableFooterView = myFooter;

            set.Apply();

            TableView.ReloadData();
            ViewModel.WeakSubscribe(PropertyChanged);

            NavigationItem.BackBarButtonItem = new UIBarButtonItem("Results",
                         UIBarButtonItemStyle.Bordered, BackButtonEventHandler);
        }
开发者ID:rossdargan,项目名称:PropertyCross-Mvvmcross,代码行数:33,代码来源:SearchResultsView.cs

示例10: ViewDidLoad

        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            View.BackgroundColor = UIColor.Magenta;

            modalButton = new UIButton ();
            modalButton.TouchUpInside += (sender, e) =>
            {
                NavigationController.PresentViewController(new MyModalViewController(), true, null);
            };

            modalButton.SetTitle ("Nested FirstVC Button", UIControlState.Normal);
            modalButton.BackgroundColor = UIColor.Blue;
            modalButton.SetTitleColor (UIColor.White, UIControlState.Normal);

            View.BackgroundColor = UIColor.Green;

            View.AddSubviews (modalButton);
            View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints ();
            View.AddConstraints
            (
                modalButton.AtTopOf(View).Plus(80),
                modalButton.WithSameCenterX(View),
                modalButton.WithSameWidth(View).Minus(20),
                modalButton.Height().EqualTo(40)
            );
        }
开发者ID:raghurana,项目名称:XamarinIosAutoLayoutBug,代码行数:28,代码来源:FirstViewController.cs

示例11: FABarButtonItem

        public FABarButtonItem(FA icon, string title, UIColor fontColor, EventHandler handler)
            : base()
        {
            UIView view = new UIView (new CGRect (0, 0, 32, 32));

            _iconButton = new UIButton (new CGRect (0, 0, 32, 21)) {
                Font = icon.Font (20),
            };
            _iconButton.SetTitleColor (fontColor, UIControlState.Normal);
            _iconButton.TouchUpInside += handler;

            _titleLabel = new UILabel (new CGRect (0, 18, 32, 10)) {
                TextColor = fontColor,
                Font = UIFont.SystemFontOfSize(10f),
                TextAlignment = UITextAlignment.Center
            };

            this.Title = title;
            this.Icon = icon.String();

            view.Add (_iconButton);
            view.Add (_titleLabel);

            CustomView = view;
        }
开发者ID:lduchosal,项目名称:FontAwesone,代码行数:25,代码来源:FABarButtonItem.cs

示例12: ViewDidLoad

		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();
			NavBar=new UINavigationBar(new CoreGraphics.CGRect (0, 0, pview.uvWidth, 44));
			NavBar.BackgroundColor = UIColor.Red;
//			UIBarButtonItem bbitemCancel = new UIBarButtonItem (UIBarButtonSystemItem.Cancel, CancelButtonClicked);
			UIButton btnCancel = new UIButton (new CGRect (0, 0, 80, 30));
			btnCancel.SetTitleColor (UIColor.Blue, UIControlState.Normal);
			btnCancel.SetTitle ("Cancel", UIControlState.Normal);
			btnCancel.TouchUpInside += (object sender, EventArgs e) => {
				pview.popover.Dismiss(false);
			};
			UIBarButtonItem bbitemCancel = new UIBarButtonItem (btnCancel);

//			UIBarButtonItem bbitemDone = new UIBarButtonItem (UIBarButtonSystemItem.Done, DoneButtonClicked);
			UIButton btnDone = new UIButton (new CGRect (0, 0, 80, 30));
			btnDone.SetTitleColor (UIColor.Blue, UIControlState.Normal);
			btnDone.SetTitle ("Done", UIControlState.Normal);
			btnDone.TouchUpInside += (object sender, EventArgs e) => {
				pview.DismissPopOver ();
			};
			UIBarButtonItem bbitemDone = new UIBarButtonItem (btnDone);

			UINavigationItem navgitem = new UINavigationItem ("Select");
			navgitem.SetLeftBarButtonItem(bbitemCancel,true);
			navgitem.SetRightBarButtonItem (bbitemDone, true);
			NavBar.PushNavigationItem(navgitem,true);
			this.View.Add (NavBar);
			searchBar=new UISearchBar(new CoreGraphics.CGRect (0, 44, pview.uvWidth, 44));
			this.View.Add(searchBar);
			rvc = new RootViewController (RootData,pview);
			rvc.View.Frame = new CoreGraphics.CGRect (0, 88, pview.uvWidth, 600);
			this.subview.SetRootview(rvc);
			this.View.Add (rvc.View);
		}
开发者ID:Nahidahmed,项目名称:iProPQRS,代码行数:35,代码来源:RootGroupView.cs

示例13: AddMissions

 void AddMissions()
 {
     IList<Core.Domain.Mission> missions;
     
     ((EarthViewModel)ViewModel).PropertyChanged += (sender, e) =>
     {
         missions = ((EarthViewModel)ViewModel).Missions;
         
         if (missions != null)
         {
             foreach (var mission in missions)
             {                    
                 var missionView = new UIButton(UIButtonType.System);
                 missionView.SetTitle(mission.Name, UIControlState.Normal);
                 missionView.Frame = new RectangleF(mission.X, mission.Y, 100, 40);
                 missionView.BackgroundColor = UIColor.FromRGBA(0.027f, 0.102f, 0.389f, 1.000f);
                 
                 missionView.SetTitleColor(UIColor.White, UIControlState.Normal);
                 missionView.Layer.BorderColor = UIColor.FromRGBA(0.008f, 0.137f, 0.620f, 1.000f).CGColor;
                 missionView.Layer.CornerRadius = 4;
                 missionView.Layer.BorderWidth = 1;
             
                 missionView.TouchUpInside += (s, ee) =>
                 {
                     ((EarthViewModel)ViewModel).ShowMissionCommand.Execute(mission);
                 };
             
                 View.AddSubview(missionView);
             }
         }
     };
 }
开发者ID:rootdevelop,项目名称:Sunny,代码行数:32,代码来源:EarthView.cs

示例14: ViewDidLoad

		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();
			Title = "Buttons";
			View.BackgroundColor = UIColor.White;

			buttonRect = UIButton.FromType(UIButtonType.RoundedRect);
			buttonRect.SetTitle ("Click me", UIControlState.Normal);
			buttonRect.SetTitle ("Clicking me", UIControlState.Highlighted);
			buttonRect.SetTitle ("Disabled", UIControlState.Disabled);
			buttonRect.SetTitleColor (UIColor.LightGray, UIControlState.Disabled);


			buttonCustom = UIButton.FromType(UIButtonType.RoundedRect);
			buttonCustom.SetTitle ("Button", UIControlState.Normal);
			buttonCustom.SetTitle ("Button!!!!", UIControlState.Highlighted);
			buttonCustom.Font = UIFont.FromName ("Helvetica-BoldOblique", 26f);
			buttonCustom.SetTitleColor (UIColor.Brown, UIControlState.Normal);
			buttonCustom.SetTitleColor (UIColor.Yellow, UIControlState.Highlighted);
			buttonCustom.SetTitleShadowColor (UIColor.DarkGray, UIControlState.Normal);
			
			buttonRect.Frame 		= new CGRect(160, 100, 140, 40);
			buttonCustom.Frame 		= new CGRect(160, 180, 140, 60);

			buttonRect.TouchUpInside += HandleTouchUpInside;
			buttonCustom.TouchUpInside += HandleTouchUpInside;
		
			View.AddSubview (buttonRect);
			View.AddSubview (buttonCustom);

		}
开发者ID:4lenz1,项目名称:recipes,代码行数:31,代码来源:ButtonsViewController.cs

示例15: ViewDidLoad

		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();
			userPro = new UserProcess ();

			hud = new MTMBProgressHUD (this.View) {
				LabelText = "Waiting...",
				RemoveFromSuperViewOnHide = true,
				DimBackground = true
			};
			this.View.AddSubview (hud);

			this.NavigationController.NavigationBarHidden = true;
			this.View.BackgroundColor = UIColor.FromRGB (230, 236, 245);

			imgView = new UIImageView (new CoreGraphics.CGRect (0, 0, this.View.Frame.Width, this.View.Frame.Height));
			imgView.Image = UIImage.FromFile ("System/bg.png");

			btnGoMain = new UIButton (UIButtonType.System);
			btnGoMain.Frame = new CoreGraphics.CGRect (this.View.Frame.Width / 2 - 100, this.View.Frame.Height / 2 + 150, 200, 50);
			btnGoMain.SetTitle ("开启DIY定制", UIControlState.Normal);
			btnGoMain.SetTitleColor (UIColor.White, UIControlState.Normal);
			btnGoMain.Font = UIFont.FromName ("Helvetica-Bold", 30f);
			btnGoMain.TouchUpInside += btnGoMain_TouchUpInside;

			btnLogout = new UIButton (UIButtonType.System);
			btnLogout.SetImage (UIImage.FromFile ("System/椭圆 1.png"), UIControlState.Normal);
			btnLogout.Frame = new CoreGraphics.CGRect (980, 25, 30, 30);
			btnLogout.BackgroundColor = UIColor.White;
			btnLogout.TouchUpInside += BtnLogout_TouchUpInside;

			this.View.AddSubviews (imgView, btnGoMain, btnLogout);
		}
开发者ID:raisonzzy,项目名称:HaApp,代码行数:33,代码来源:MainController.cs


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