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


C# UITableViewCell.AddSubview方法代码示例

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


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

示例1: GetCell

		public override UITableViewCell GetCell (UITableView tv)
		{
			sc = new UISegmentedControl () {
				BackgroundColor = UIColor.Clear,
				Tag = 1,
			};
			sc.Selected = true;

			sc.InsertSegment (choices [0].Text, 0, false);
			sc.InsertSegment (choices [1].Text, 1, false);
			sc.Frame = new RectangleF (570f, 8f, 150f, 26f);

			sc.SelectedSegment = choices.FindIndex (e => e.Id == val.Id);
			sc.AddTarget (delegate {
				Value = choices [sc.SelectedSegment];
			}, UIControlEvent.ValueChanged);

			var cell = tv.DequeueReusableCell (CellKey);
//			if (cell == null) {
				cell = new UITableViewCell (UITableViewCellStyle.Default, CellKey);
				cell.SelectionStyle = UITableViewCellSelectionStyle.None;
				cell.AddSubview (sc);
//			} 
//			else
//				RemoveTag (cell, 1);
			cell.TextLabel.Font = UIFont.BoldSystemFontOfSize (17);
			//cell.Frame.Height = 44;
			cell.TextLabel.Text = Caption;
			if (this.IsMandatory)
				cell.TextLabel.Text += "*";
			

			return cell;
		}
开发者ID:ClusterReplyBUS,项目名称:MonoTouch.Dialog,代码行数:34,代码来源:TwoStateElement.cs

示例2: GetCell

		public override UITableViewCell GetCell (UITableView tv)
		{
			var cell = tv.DequeueReusableCell(this.CellKey);
			UIImageView iv = null;
			
			if (cell == null)
			{
				cell = new UITableViewCell(UITableViewCellStyle.Default, this.CellKey);
				
				iv = new UIImageView(new RectangleF(10f, 5f, tv.Bounds.Width - 20f, this.MaxHeight - 10f));
				iv.Tag = 101;
				iv.ContentMode = UIViewContentMode.ScaleAspectFit;
				
				cell.AddSubview(iv);
				
			}
			else
			{
				iv = cell.ViewWithTag(101) as UIImageView;
				
			}
			
			iv.Image = this.Image;
			
			return cell;
		}
开发者ID:Bogdan-p,项目名称:ZXing.Net,代码行数:26,代码来源:ImageDisplayElement.cs

示例3: CellContentFactoryImplementationForPerson1

			UITableViewCell CellContentFactoryImplementationForPerson1 ()
		{
			UITableViewCell cc = new UITableViewCell();
			UIView content_view = UIViewFactory();		// wrap UIView
			cc.Bounds = content_view.Bounds;
			cc.AddSubview(content_view);
			
			return cc;			
		}
开发者ID:moljac,项目名称:MonoTouch.Samples,代码行数:9,代码来源:UITabBarControllerWithTabBarOnTopAndTabsContainingDialogViewControllers.ManualXIBless.cs

示例4: ViewDidLoad

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

            var btnAddBookmark = new UIBarButtonItem();
            btnAddBookmark.Image = UIImage.FromFile("add.png");
            btnAddBookmark.Clicked += delegate {
                setEditMode(UITableViewCellEditingStyle.Insert);
            };
            var btnDeleteBookmark = new UIBarButtonItem();
            btnDeleteBookmark.Image = UIImage.FromFile("delete.png");
            btnDeleteBookmark.Clicked += delegate {
                setEditMode(UITableViewCellEditingStyle.Delete);
            };
            var btnClose = new UIBarButtonItem();
            btnClose.Image = UIImage.FromFile("close.png");
            btnClose.Clicked += delegate {
                DismissViewController(true, null);
            };
            var space = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace);

            var toolBarTitle = new UILabel(new RectangleF(0, 0, View.Bounds.Width, 44));
            toolBarTitle.AutoresizingMask = UIViewAutoresizing.FlexibleWidth;
            toolBarTitle.BackgroundColor = UIColor.Clear;
            toolBarTitle.TextColor = UIColor.White;
            toolBarTitle.TextAlignment = UITextAlignment.Center;
            toolBarTitle.Text = "Bookmarks".t();

            var toolBar = new UIToolbar(new RectangleF(0, 0, View.Bounds.Width, 44));
            toolBar.BarStyle = UIBarStyle.Black;
            toolBar.AutoresizingMask = UIViewAutoresizing.FlexibleBottomMargin |UIViewAutoresizing.FlexibleWidth;
            toolBar.SetItems(new [] { btnAddBookmark, btnDeleteBookmark, space, btnClose }, false);
            toolBar.AddSubview(toolBarTitle);
            View.AddSubview(toolBar);

            _bookmarksTable = new UITableView(new RectangleF(0, 44, View.Bounds.Width, View.Bounds.Height), UITableViewStyle.Plain);
            _bookmarksTable.AutoresizingMask = UIViewAutoresizing.FlexibleHeight;
            _bookmarksTable.Source = new DataSource(this);
            View.AddSubview(_bookmarksTable);

            _newBookmarkCell = new UITableViewCell(UITableViewCellStyle.Default, null);
            _newBookmarkCell.AutoresizingMask = UIViewAutoresizing.FlexibleRightMargin;
            _newBookmarkCell.Frame = new RectangleF(0, 0, View.Bounds.Width, 55);
            _newBookmarkNameTxt = new UITextField(new RectangleF(40, 12, View.Bounds.Width - 45, 31));
            _newBookmarkNameTxt.AutoresizingMask = UIViewAutoresizing.FlexibleWidth;
            _newBookmarkNameTxt.BorderStyle = UITextBorderStyle.RoundedRect;
            _newBookmarkNameTxt.Font = UIFont.SystemFontOfSize(16.0f);
            _newBookmarkCell.AddSubview(_newBookmarkNameTxt);
        }
开发者ID:phantomlight,项目名称:mTouch-PDFReader,代码行数:49,代码来源:BookmarksVC.cs

示例5: TableSource

            public TableSource()
            {
                expenseViewModel = ServiceContainer.Resolve<ExpenseViewModel>();

                categoryCell = new UITableViewCell (UITableViewCellStyle.Default, null);
                categoryCell.TextLabel.Text = "Category";
                categoryCell.SelectionStyle = UITableViewCellSelectionStyle.None;
                categoryCell.AccessoryView = category = new UILabel (new CGRect(0f, 0f, 200f, 36f)) {
                    TextAlignment = UITextAlignment.Right,
                    BackgroundColor = UIColor.Clear,
                };

                costCell = new UITableViewCell (UITableViewCellStyle.Default, null);
                costCell.TextLabel.Text = "Cost";
                costCell.SelectionStyle = UITableViewCellSelectionStyle.None;
                costCell.AccessoryView = cost = new UITextField(new CGRect (0f, 0f, 200f, 36f))
                {
                    VerticalAlignment = UIControlContentVerticalAlignment.Center,
                    TextAlignment = UITextAlignment.Right,
                };
                cost.SetDidChangeNotification (c =>
                {
                    string text = c.Text.Replace ("$", string.Empty);
                    decimal value;
                    expenseViewModel.SelectedExpense.Cost = decimal.TryParse (text, out value) ? Math.Abs (value) : 0;
                });

                descriptionCell = new UITableViewCell (UITableViewCellStyle.Default, null) {
                    SelectionStyle = UITableViewCellSelectionStyle.None
                };
                descriptionCell.AccessoryView = description = new PlaceholderTextView (new CGRect (0f, 0f, Theme.IsiOS7 ? 515f : 470f, 90f)) {
                    BackgroundColor = UIColor.Clear,
                    Placeholder = "Please enter notes here",
                };
                description.SetDidChangeNotification (d =>
                    expenseViewModel.SelectedExpense.Description = description.Text != description.Placeholder ? d.Text : string.Empty
                );

                photoCell = new UITableViewCell(UITableViewCellStyle.Default, null) {
                    SelectionStyle = UITableViewCellSelectionStyle.None
                };

                photoButton = UIButton.FromType (UIButtonType.Custom);
                photoButton.SetBackgroundImage (Theme.AddPhoto, UIControlState.Normal);
                photoButton.SetTitle ("Add Photo", UIControlState.Normal);
                photoButton.SetTitleColor (Theme.LabelColor, UIControlState.Normal);
                photoButton.ContentEdgeInsets = new UIEdgeInsets (0f, 0f, 2f, 0f);
                photoButton.Frame = new CGRect (210f, 130f, 115f, 40f);
                photoButton.TouchUpInside += (sender, e) => {
                    if (photoSheet == null) {
                        photoSheet = new PhotoAlertSheet();

                        //Set the desired size for the resulting image
                        var size = photo.Frame.Size;
                        var scale = UIScreen.MainScreen.Scale;
                        size.Width *= scale;
                        size.Height *= scale;
                        photoSheet.DesiredSize = size;

                        //Set the callback for when the image is selected
                        photoSheet.Callback = image => {
                            if (expenseViewModel.Photo == null)
                                expenseViewModel.Photo = new ExpensePhoto { ExpenseId = expenseViewModel.SelectedExpense.Id };

                            expenseViewModel.Photo.Image = image.ToByteArray ();
                            Load (enabled);
                        };
                    }
                    photoSheet.ShowFrom (photoButton.Frame, photoCell, true);
                };
                photoCell.AddSubview (photoButton);
                var frame = photoCell.Frame;
                frame.X = 18f;
                frame.Width -= 34f;

                photo = new UIImageView (frame) {
                    AutoresizingMask = UIViewAutoresizing.All,
                    ContentMode = UIViewContentMode.ScaleAspectFit
                };

                photo.Layer.BorderWidth = 1f;
                photo.Layer.BorderColor = new CGColor (0xcf, 0xcf, 0xcf, 0x7f);
                photo.Layer.CornerRadius = 10f;
                photo.Layer.MasksToBounds = true;
                photoCell.AddSubview (photo);
            }
开发者ID:tranuydu,项目名称:prebuilt-apps,代码行数:86,代码来源:AddExpenseController.cs

示例6: BuildNextResultsCell

        private UITableViewCell BuildNextResultsCell(string text, float tableWidth)
        {
            var cell = new UITableViewCell(UITableViewCellStyle.Default, "lastcell");
                cell.TextLabel.Text = text;
                cell.TextLabel.Font = UIFont.BoldSystemFontOfSize(15);
                cell.TextLabel.TextAlignment = UITextAlignment.Center;
                cell.SelectionStyle = UITableViewCellSelectionStyle.None;

                if (_pagingActivity != null)
                    _pagingActivity.RemoveFromSuperview();

                _pagingActivity = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.Gray);
                _pagingActivity.Frame = new RectangleF((tableWidth - 32) / 2, 4, 32, 32);
                _pagingActivity.HidesWhenStopped = true;
                cell.AddSubview(_pagingActivity);
                _pagingCell = cell;
                return cell;
        }
开发者ID:jivkopetiov,项目名称:StackApp,代码行数:18,代码来源:RichListController.cs

示例7: GetCell

 public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
 {
     var cell = new UITableViewCell(UITableViewCellStyle.Default, "loadingcell");
         cell.SelectionStyle = UITableViewCellSelectionStyle.None;
         cell.AddSubview(CellActivity(tableView));
         return cell;
 }
开发者ID:jivkopetiov,项目名称:StackApp,代码行数:7,代码来源:RichListController.cs

示例8: GetCell

 public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
 {
     var msg = room.Messages [indexPath.Row];
     var ret = new UITableViewCell ();
     var width = UIScreen.MainScreen.Bounds.Width;
     var l = new UILabel (new RectangleF (0, 0, width, 16));
     l.Font = UIFont.BoldSystemFontOfSize (16);
     l.Text = msg.NickName;
     var m = new UILabel (new RectangleF (0, 16, width, 32));
     m.Text = msg.Text;
     m.LineBreakMode = UILineBreakMode.CharacterWrap;
     m.AutoresizingMask = UIViewAutoresizing.FlexibleHeight;
     ret.AddSubview (l);
     ret.AddSubview (m);
     return ret;
 }
开发者ID:atsushieno,项目名称:slingr,代码行数:16,代码来源:Main.cs

示例9: CellContentFactoryImplementationForPerson2

			UITableViewCell CellContentFactoryImplementationForPerson2()
		{
			UITableViewCell cc = new UITableViewCell();


			UIView uiview_xibless = new UIView();
			uiview_xibless.Frame = new RectangleF(0, 0, 750, 44);

			UIButton btnDelete;
			UILabel lblName;
			UILabel lblDate;

			btnDelete = UIButton.FromType(UIButtonType.Custom);
			btnDelete.Frame = new RectangleF(30, 8, 100, 27);
			lblName = new UILabel(new RectangleF(150, 8 + 3, 350, 21));
			lblDate = new UILabel(new RectangleF(500, 8 + 3, 150, 21));

			//UIControlState = Normal -> default system state for iOS element
			//UIControlState = Highlighted -> Highlighted state of a control. 
			//								A control enters this state when a touch enters and exits 
			//								during tracking and when there is a touch up event.
			btnDelete.SetTitleColor(UIColor.Green, UIControlState.Normal);
			btnDelete.SetTitleColor(UIColor.Orange, UIControlState.Highlighted);

			btnDelete.SetTitle("Delete", UIControlState.Normal);
			btnDelete.TouchUpInside += (object sender, EventArgs e) =>
			{

			};

			lblName.Text = "Name";
			lblDate.Text = DateTime.Now.ToString();

			UIView[] views = 
			{
				btnDelete,
				lblName,
				lblDate
			};

			uiview_xibless.AddSubviews(views);

			UIView content_view = uiview_xibless;		// wrap UIView
			cc.Bounds = content_view.Bounds;
			cc.AddSubview(content_view);

			return cc;
		}
开发者ID:moljac,项目名称:MonoTouch.Samples,代码行数:48,代码来源:UITabBarControllerWithTabBarOnTopAndTabsContainingDialogViewControllers.ManualXIBless.cs

示例10: GetButtonCell

 private UITableViewCell GetButtonCell()
 {
     var cell = new UITableViewCell (UITableViewCellStyle.Default, _cellIdentifier);
     cell.AddSubview (BtnAdd);
     return cell;
 }
开发者ID:RoTTex,项目名称:FirstMy,代码行数:6,代码来源:TableSource.cs

示例11: ViewDidLoad

        /// <summary>
        /// Calls when view are loaded 
        /// </summary>
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Create toolbar, title label and buttons
            var toolBar = new UIToolbar(new RectangleF(0, 0, View.Bounds.Width, 44));
            toolBar.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleBottomMargin;
            toolBar.BarStyle = UIBarStyle.Black;
            var toolBarTitle = new UILabel(new RectangleF(0, 0, View.Bounds.Width, 44));
            toolBarTitle.AutoresizingMask = UIViewAutoresizing.FlexibleWidth;
            toolBarTitle.BackgroundColor = UIColor.Clear;
            toolBarTitle.TextAlignment = UITextAlignment.Center;
            toolBarTitle.TextColor = UIColor.White;
            toolBarTitle.Font = UIFont.SystemFontOfSize(18.0f);
            toolBarTitle.Text = "Bookmarks".t();
            var btnAddBookmark = new UIButton(new RectangleF(5, 5, 30, 30));
            btnAddBookmark.SetImage(UIImage.FromFile("Images/Toolbar/BookmarkAdd32.png"), UIControlState.Normal);
            btnAddBookmark.TouchUpInside += delegate {
                SetEditingMode(UITableViewCellEditingStyle.Insert);
            };
            var btnDeleteBookmark = new UIButton(new RectangleF(43, 5, 30, 30));
            btnDeleteBookmark.SetImage(UIImage.FromFile("Images/Toolbar/BookmarkDelete32.png"), UIControlState.Normal);
            btnDeleteBookmark.TouchUpInside += delegate {
                SetEditingMode(UITableViewCellEditingStyle.Delete);
            };
            toolBar.AddSubview(toolBarTitle);
            toolBar.AddSubview(btnAddBookmark);
            toolBar.AddSubview(btnDeleteBookmark);
            View.AddSubview(toolBar);

            // Create bookmarks table
            mBookmarksTable = new UITableView(new RectangleF(0, 44, View.Bounds.Width, View.Bounds.Height), UITableViewStyle.Plain);
            mBookmarksTable.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            mBookmarksTable.RowHeight = 55;
            mBookmarksTable.Source = new DataSource(this);
            View.AddSubview(mBookmarksTable);

            // Create bookmark cell and text field
            mNewBookmarkCell = new UITableViewCell(UITableViewCellStyle.Default, null);
            mNewBookmarkCell.AutoresizingMask = UIViewAutoresizing.FlexibleRightMargin;
            mNewBookmarkCell.Frame = new RectangleF(0, 0, View.Bounds.Width, 55);
            mNewBookmarkNameTxt = new UITextField(new RectangleF(40, 12, View.Bounds.Width - 45, 31));
            mNewBookmarkNameTxt.AutoresizingMask = UIViewAutoresizing.FlexibleWidth;
            mNewBookmarkNameTxt.BorderStyle = UITextBorderStyle.RoundedRect;
            mNewBookmarkNameTxt.Font = UIFont.SystemFontOfSize(16.0f);
            mNewBookmarkCell.AddSubview(mNewBookmarkNameTxt);
        }
开发者ID:xuanvu,项目名称:mTouch-PDFReader,代码行数:50,代码来源:BookmarksViewController.cs

示例12: GetCell

            public override UITableViewCell GetCell(UITableView tableView, MonoTouch.Foundation.NSIndexPath indexPath)
            {
                if (indexPath.Section == 0) {
                    var infocell = new UITableViewCell ();
                    if (controller._controllerMode == 2) {
                        var inform = AppApi.GetSheets ().DataStudent.First (x => x.Id == editModel.SheetId);
                        //Customizing the progress bar
                        float sumWordAnswers = inform.Bad + inform.Good + inform.Nearly + inform.No;
                        var customProgressBar = UICustomProgressBar.Create ();
                        customProgressBar.Frame = new System.Drawing.RectangleF (10, 40, UIScreen.MainScreen.Bounds.Width-20, 4);
                        var width = customProgressBar.Frame.Width;
                        var height = customProgressBar.Frame.Height;

                        if (sumWordAnswers != 0) {

                            var badWidth = (inform.Bad / sumWordAnswers) * width;
                            var goodWidth = (inform.Good / sumWordAnswers) * width;
                            var noWidth = (inform.No / sumWordAnswers) * width;
                            var nearlyWidth = (inform.Nearly / sumWordAnswers) * width;

                            customProgressBar.ProgressBarRed = new System.Drawing.RectangleF (0, 2, badWidth, height);
                            customProgressBar.ProgressBarYellow = new System.Drawing.RectangleF (badWidth, 2, nearlyWidth, height);
                            customProgressBar.ProgressBarGreen = new System.Drawing.RectangleF (badWidth + nearlyWidth, 2, goodWidth, height);
                            customProgressBar.ProgressBarSilver = new System.Drawing.RectangleF (badWidth + nearlyWidth + goodWidth, 2, noWidth, height);

                        } else {
                            customProgressBar.ProgressBarRed = new System.Drawing.RectangleF (0, 0, 0, 0);
                            customProgressBar.ProgressBarYellow = new System.Drawing.RectangleF (0, 0, 0, 0);
                            customProgressBar.ProgressBarGreen = new System.Drawing.RectangleF (0, 0, 0, 0);
                            customProgressBar.ProgressBarSilver = new System.Drawing.RectangleF (0, 0, width, height);
                        }
                        infocell.AddSubview (customProgressBar);
                    } else {
                        UITextField title = new UITextField (new System.Drawing.RectangleF (15, 35, UIScreen.MainScreen.Bounds.Width - 130, 20));
                        title.Placeholder = "Введите название";
                        title.BorderStyle = UITextBorderStyle.RoundedRect;
                        if (editModel != null)
                            title.Text = editModel.Name;

                        UIButton save = new UIButton (new System.Drawing.RectangleF (title.Frame.Right + 5, 35, 100, 20));
                        save.SetTitle ("Сохранить", UIControlState.Normal);
                        save.BackgroundColor = UIColor.FromRGB (15, 83, 250);

                        save.TouchUpInside += (object sender, EventArgs e) => {

                        };

                        infocell.AddSubviews (new UIView[]{ title, save });
                    }

                    return infocell;
                }

                var cell = UIWordEdit.Create (); //tableView.DequeueReusableCell (UIWordEdit.Key, indexPath) as UIWordEdit;
                // if there are no cells to reuse, create a new one
                //if (cell == null)
                //	cell = new UIListWordCell (UITableViewCellStyle.Default, cellIdentifier);

                var oneItem = model.Data [indexPath.Row];
                cell.Id = oneItem.Id;
                cell.Russian = oneItem.Russian;
                cell.Transcr = oneItem.Transcription;
                cell.Example = oneItem.Description;
                cell.English = oneItem.English;
                cell.EditBtmEvent = (object sender, EventArgs e) => {
                    controller.Edit (model.Data [indexPath.Row]);
                };
                cell.DelBtmEvent = (object sender, EventArgs e) => {
                    if (!AppApi.DeleteWord (model.Data [indexPath.Row].Id))
                        return;
                    model.Data.RemoveAt (indexPath.Row);
                    tableView.DeleteRows (new NSIndexPath[]{ indexPath }, UITableViewRowAnimation.Fade);
                };

                if (controller._controllerMode == 2)
                    cell.DisableControls = true;

                return cell;
            }
开发者ID:raskarov,项目名称:wordzilla_xamarin,代码行数:79,代码来源:EditWordsController.cs


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