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


C# UIView.Add方法代码示例

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


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

示例1: LoadView

        public override void LoadView()
        {
            var view = new UIView(UIScreen.MainScreen.ApplicationFrame)
            {
                BackgroundColor = FlatUI.Color.Clouds,
                AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight
            };

            bbi = new UIBarButtonItem("New", UIBarButtonItemStyle.Plain, HandleTouchUpInside);
            NavigationItem.RightBarButtonItem = bbi;

            btnShadowed = new FUIShadowedButton(new RectangleF(50, 50, 320 - 100, 44), FlatUI.Color.PeterRiver, FlatUI.Color.PeterRiver.Darken(1));
            btnShadowed.SetTitle("Shadowed", UIControlState.Normal);
            view.Add(btnShadowed);

            btnFlat = new FUIButton(new RectangleF(50, 120, 320 - 100, 44), FlatUI.Color.PeterRiver, FlatUI.Color.PeterRiver.Darken(1))
            {
                AutoresizingMask = UIViewAutoresizing.FlexibleWidth,
                Font = FlatUI.BoldFontOfSize(19)
            };
            btnFlat.SetTitle("Flat", UIControlState.Normal);
            view.Add(btnFlat);

            this.View = view;
        }
开发者ID:natecook1000,项目名称:FlatUIKit.Xamarin,代码行数:25,代码来源:TestVC.cs

示例2: GetRoot

		private RootElement GetRoot()
		{
			var rect = new RectangleF(PadX, 0, View.Bounds.Width - 30 - PadX * 2, 100);
			_detailView = new SeriesDetailView(_series, rect);
			
			_triangleView = new TriangleView (UIColor.FromRGB(247, 247, 247), UIColor.FromRGB (171, 171, 171)) {
				Frame = new RectangleF (43, _detailView.Bounds.Height - 7, 16, 8)
			};
			
			_containerView = new UIView(rect);
			_containerView.Add(_detailView);
			_containerView.Add(_triangleView);
			
			var text = new StyledMultilineElement(_series.Description);
			text.TextColor = UIColor.DarkGray;
			text.LineBreakMode = UILineBreakMode.WordWrap;
			text.Font = UIFont.ItalicSystemFontOfSize(14);
			text.DetailColor = text.TextColor;
						
			var main = new Section(_containerView)
			{
				text
			};
			
			var root = new RootElement("")
			{
				main
		 	};
			
			return root;
		}
开发者ID:modulexcite,项目名称:artapp,代码行数:31,代码来源:SeriesDetailViewController.cs

示例3: GetCell

		public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath)
		{
			UITableViewCell cell = tableView.DequeueReusableCell (CellIdentifier);

			string item = TableItems[indexPath.Row];

			if(ContentItems!=null)
			 item2 = ContentItems[indexPath.Row];
			if (cell == null)
			{ cell = new UITableViewCell (UITableViewCellStyle.Default, CellIdentifier); }
			if (customise) {
				UIView centerview = new UIView ();
				centerview.Frame = cell.Frame;
				centerview.BackgroundColor = UIColor.White;
				UILabel ll = new UILabel (new CGRect (15, 2, 100, 20));
				ll.Font= UIFont.FromName ("Helvetica", 15f);
				ll.Text = item;
				centerview.Add (ll);
				UILabel ll1 = new UILabel (new CGRect (15, 20, 300, 20));
				ll1.Text = item2;
				ll1.Font= UIFont.FromName ("Helvetica", 13f);
				centerview.Add (ll1);
				cell.ContentView.Add (centerview);

			} else {
				cell.TextLabel.Text = item;
			}
			return cell;
		}
开发者ID:IanLeatherbury,项目名称:tryfsharpforms,代码行数:29,代码来源:TableSource.cs

示例4: LoadView

        public override void LoadView ()
        {
            var view = new UIView ().Apply (Style.Screen);

            view.Add (nameTextField = new TextField () {
                TranslatesAutoresizingMaskIntoConstraints = false,
                AttributedPlaceholder = new NSAttributedString (
                    "NewProjectNameHint".Tr (),
                    foregroundColor: Color.Gray
                ),
                ShouldReturn = (tf) => tf.ResignFirstResponder (),
            }.Apply (Style.NewProject.NameField).Apply (BindNameField));
            nameTextField.EditingChanged += OnNameFieldEditingChanged;

            view.Add (clientButton = new UIButton () {
                TranslatesAutoresizingMaskIntoConstraints = false,
            }.Apply (Style.NewProject.ClientButton).Apply (BindClientButton));
            clientButton.TouchUpInside += OnClientButtonTouchUpInside;

            view.AddConstraints (VerticalLinearLayout (view));

            EdgesForExtendedLayout = UIRectEdge.None;
            View = view;

            NavigationItem.RightBarButtonItem = new UIBarButtonItem (
                "NewProjectAdd".Tr (), UIBarButtonItemStyle.Plain, OnNavigationBarAddClicked)
                .Apply (Style.NavLabelButton);
        }
开发者ID:nagyist,项目名称:toggl-mobile,代码行数:28,代码来源:NewProjectViewController.cs

示例5: LoadView

        public override void LoadView ()
        {
            var view = new UIView ().Apply (Style.Screen);

            view.Add (nameTextField = new TextField () {
                TranslatesAutoresizingMaskIntoConstraints = false,
                AttributedPlaceholder = new NSAttributedString (
                    "NewProjectNameHint".Tr (),
                    foregroundColor: Color.Gray
                ),
                ShouldReturn = (tf) => tf.ResignFirstResponder (),
            } .Apply (Style.NewProject.NameField));
            nameTextField.EditingChanged += (sender, e) => ValidateProjectName ();

            view.Add (clientButton = new UIButton () {
                TranslatesAutoresizingMaskIntoConstraints = false,
            } .Apply (Style.NewProject.ClientButton).Apply (Style.NewProject.NoClient));
            clientButton.SetTitle ("NewProjectClientHint".Tr (), UIControlState.Normal);
            clientButton.TouchUpInside += OnClientButtonTouchUpInside;

            view.AddConstraints (VerticalLinearLayout (view));

            EdgesForExtendedLayout = UIRectEdge.None;
            View = view;

            var addBtn = new UIBarButtonItem (
                "NewProjectAdd".Tr (), UIBarButtonItemStyle.Plain, OnSetBtnPressed)
            .Apply (Style.NavLabelButton).Apply (Style.DisableNavLabelButton);
            addBtn.Enabled = false;
            NavigationItem.RightBarButtonItem = addBtn;
        }
开发者ID:eatskolnikov,项目名称:mobile,代码行数:31,代码来源:NewProjectViewController.cs

示例6: LoadView

		public override void LoadView ()
		{
			View = new UIView ();
			View.BackgroundColor = UIColor.White;

			var imageView = new UIImageView ();
			imageView.ContentMode = UIViewContentMode.ScaleAspectFit;
			imageView.TranslatesAutoresizingMaskIntoConstraints = false;
			ImageView = imageView;
			View.Add (ImageView);

			var ratingControl = new RatingControl ();
			ratingControl.TranslatesAutoresizingMaskIntoConstraints = false;
			ratingControl.AddTarget (RatingChanges, UIControlEvent.ValueChanged);
			RatingControl = ratingControl;
			View.Add (RatingControl);

			var overlayButton = new OverlayView ();
			overlayButton.TranslatesAutoresizingMaskIntoConstraints = false;
			OverlayButton = overlayButton;
			View.Add (OverlayButton);

			UpdatePhoto ();

			View.AddConstraints (NSLayoutConstraint.FromVisualFormat ("|[imageView]|",
				NSLayoutFormatOptions.DirectionLeadingToTrailing,
				"imageView", imageView));

			View.AddConstraints (NSLayoutConstraint.FromVisualFormat ("V:|[imageView]|",
				NSLayoutFormatOptions.DirectionLeadingToTrailing,
				"imageView", imageView));

			View.AddConstraints (NSLayoutConstraint.FromVisualFormat ("[ratingControl]-|",
				NSLayoutFormatOptions.DirectionLeadingToTrailing,
				"ratingControl", ratingControl));

			View.AddConstraints (NSLayoutConstraint.FromVisualFormat ("[overlayButton]-|",
				NSLayoutFormatOptions.DirectionLeadingToTrailing,
				"overlayButton", overlayButton));

			View.AddConstraints (NSLayoutConstraint.FromVisualFormat ("V:[overlayButton]-[ratingControl]-|",
				NSLayoutFormatOptions.DirectionLeadingToTrailing,
				"overlayButton", overlayButton,
				"ratingControl", ratingControl));

			var constraints = new List<NSLayoutConstraint> ();

			constraints.AddRange (NSLayoutConstraint.FromVisualFormat ("|-(>=20)-[ratingControl]",
				NSLayoutFormatOptions.DirectionLeadingToTrailing,
				"ratingControl", ratingControl));

			constraints.AddRange (NSLayoutConstraint.FromVisualFormat ("|-(>=20)-[overlayButton]",
				NSLayoutFormatOptions.DirectionLeadingToTrailing,
				"overlayButton", overlayButton));

			foreach (var constraint in constraints)
				constraint.Priority = (int)UILayoutPriority.Required - 1;

			View.AddConstraints (constraints.ToArray ());
		}
开发者ID:CBrauer,项目名称:monotouch-samples,代码行数:60,代码来源:PhotoViewController.cs

示例7: LoadView

		public override void LoadView ()
		{
			var view = new UIView ();
			view.BackgroundColor = UIColor.White;

			ImageView = new UIImageView {
				ContentMode = UIViewContentMode.ScaleAspectFit,
				TranslatesAutoresizingMaskIntoConstraints = false
			};
			view.Add (ImageView);

			NameLabel = new UILabel {
				Font = UIFont.PreferredHeadline,
				TranslatesAutoresizingMaskIntoConstraints = false
			};
			view.Add (NameLabel);

			ConversationsLabel = new UILabel {
				Font = UIFont.PreferredBody,
				TranslatesAutoresizingMaskIntoConstraints = false
			};
			view.Add (ConversationsLabel);

			PhotosLabel = new UILabel {
				Font = UIFont.PreferredBody,
				TranslatesAutoresizingMaskIntoConstraints = false
			};
			view.Add (PhotosLabel);

			View = view;
			UpdateUser ();
			UpdateConstraintsForTraitCollection (TraitCollection);
		}
开发者ID:g7steve,项目名称:monotouch-samples,代码行数:33,代码来源:ProfileViewController.cs

示例8: 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

示例9: 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

示例10: InitializeContent

		public override void InitializeContent()
		{
			_TextField = new UITextField(new RectangleF(50, 10, 250, 30));
		
			_Image = new UIImageView(new RectangleF(10, 10, 25, 25));
			
			if (ViewModel != null)
				_Image.BackgroundColor = ViewModel.Color;

			base.InitializeContent();
		
			ElementView = new UIView(RectangleF.Empty) { BackgroundColor = UIColor.ScrollViewTexturedBackgroundColor };

			ElementView.Add(_Image);
			ElementView.Add(_TextField);

		
			_TextField.EditingChanged += delegate
			{
				if (_TextField.Text.Length > 5)
				{
					ViewModel.Color = UIColor.Blue;
				} else
				{
					ViewModel.Color = UIColor.Red;
				}
				_Image.BackgroundColor = ViewModel.Color;
			};
		

			if (ViewModel != null)
			_TextField.Text = ViewModel.Text;
		}
开发者ID:vknair74,项目名称:MonoMobile.Views,代码行数:33,代码来源:EcteteraView.cs

示例11: GetRoot

		public RootElement GetRoot()
		{
			CreateTweetView("...");
			
			var width = View.Bounds.Width - 30 - PadX * 2;
			var frame = new RectangleF(PadX, 0, width, 100);
			
			var headerView = new UIView(frame);			
			_view = new BioView(_bio, frame, true);
			headerView.Add(_view);
			
			// Speech bubble triangle
			var triangleFrame = new RectangleF(Util.IsPad() ? 63 : 43, _view.Bounds.Height - 7, 16, 8);
			var triangle = new TriangleView (UIColor.FromRGB(247, 247, 247), UIColor.FromRGB(171, 171, 171)) { Frame = triangleFrame };
			headerView.Add(triangle);
						
			_view.UrlTapped += delegate
			{
				WebViewController.OpenUrl(this, _bio.Url);
			};
					
			_main = new Section(headerView)
			{
				_tweetBox
			};
			
			var text = new StyledMultilineElement(AppManifest.Current.Biography);
			text.TextColor = UIColor.DarkGray;
			text.LineBreakMode = UILineBreakMode.WordWrap;
			text.Font = UIFont.ItalicSystemFontOfSize(15);
			text.DetailColor = text.TextColor;	
			text.SelectionStyle = UITableViewCellSelectionStyle.None;
						
			var secondary = new Section("About " + AppManifest.Current.FirstName)
			{
				text
			};
			
			var root = new RootElement("Bio")
			{
				_main,
				secondary
		 	};			
			
			// Required for resizing bubble for new tweets
			root.UnevenRows = true;
			
			return root;
		}
开发者ID:modulexcite,项目名称:artapp,代码行数:49,代码来源:BioViewController.cs

示例12: Layer

 public Layer(UIView parent)
     : base(CGRect.Empty)
 {
     parent.Add (this);
     // make all layers receive touches
     UserInteractionEnabled = true;
 }
开发者ID:CBrauer,项目名称:monotouch-samples,代码行数:7,代码来源:Layer.cs

示例13: CreateRoot

		RootElement CreateRoot ()
		{
			return new RootElement ("Settings") {
				new Section (){
					new StringElement ("mes photos"
					                 /*, el => 
	                 	{				
							int userId = AppDelegateIPhone.AIphone.MainUser.Id;
							return new MembersPhotoViewControler(AppDelegateIPhone.meNavigationController, userId);
						}
						*/, ()=>
	                   {
							Action act = ()=>
							{
								int userId = AppDelegateIPhone.AIphone.MainUser.Id;
								var m = new MembersPhotoViewControler(AppDelegateIPhone.meNavigationController, userId, false);
								//this.PresentModalViewController(m, true);
								AppDelegateIPhone.meNavigationController.PushViewController(m, false);
							
								var view = new UIView();
								var btn = UIButton.FromType(UIButtonType.Custom);
								btn.Frame = new RectangleF(0, -13, 26, 26);
								btn.SetBackgroundImage(Graphics.GetImgResource("back"), UIControlState.Normal);								
								view.Add(btn);
								
							};
							AppDelegateIPhone.ShowRealLoading(View, "Loading photos", null, act);
						}
					),
					
					new StringElement ("mon profile"),					
					new StringElement("mes autres reseaux"),
				}
			};
		}
开发者ID:21Off,项目名称:21Off,代码行数:35,代码来源:MeViewCont.xib.cs

示例14: 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

示例15: Draw

		public override void Draw (RectangleF bounds, CGContext context, UIView view)
		{
			//UIColor.White.SetFill ();
			//context.FillRect (bounds);
			try
			{
				UIView searchView = view.ViewWithTag(1);				
				if (searchView == null)
				{
					var photoCellView = new PhotoCellView(_images, cellIndex, null);										
					
					photoCellView.Tag = 1;
					view.Add(photoCellView);
				}
				else
				{
					var photoCellView = (PhotoCellView)searchView;					
					photoCellView.Update(_images, cellIndex);
					
					photoCellView.DrawBorder(UIColor.Green);
				}
			}
			catch (Exception ex)
			{
				Util.LogException("Draw ImagesElement", ex);
			}
		}
开发者ID:21Off,项目名称:21Off,代码行数:27,代码来源:ImagesElement.cs


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