• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# UITableViewCell类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: GetCell

        public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath)
        {
            // request a recycled cell to save memory
            UITableViewCell cell = tableView.DequeueReusableCell (cellIdentifier);
            // if there are no cells to reuse, create a new one
			if (cell == null)
				cell = new UITableViewCell (UITableViewCellStyle.Default, cellIdentifier);
            
			cell.TextLabel.Text = tableItems [indexPath.Row].Name;

            cell.TextLabel.TextColor = UIColor.White;
            switch (tableItems [indexPath.Row].Type) {

            case "Lab":
                cell.BackgroundColor = UIColor.FromRGB (158, 30, 98);
                break;
            case "Utility":
                cell.BackgroundColor = UIColor.FromRGB (164, 164, 164);
                break;
            case "Office":
                cell.BackgroundColor = UIColor.FromRGB (11, 39, 63);
                break;
            case "Toilet":
                cell.BackgroundColor = UIColor.FromRGB (191, 185, 73);
                break;
            case "Stairs":
                cell.BackgroundColor = UIColor.FromRGB (208, 74, 45);
                break;

            }

            return cell;
        }
开发者ID:dcbright01,项目名称:Navigator,代码行数:33,代码来源:tableSource.cs


示例2: GetCell

		/// <summary>
		/// Called by the TableView to get the actual UITableViewCell to render for the particular section and row
		/// </summary>
		public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath)
		{
			// declare vars
			UITableViewCell cell = tableView.DequeueReusableCell (cellIdentifier);
			//string item = tableItems [indexPath.Row]; //.Items[indexPath.Row];

			// if there are no cells to reuse, create a new one
			if (cell == null)
				cell = new UITableViewCell (UITableViewCellStyle.Subtitle, cellIdentifier);

			// set the item text
			cell.TextLabel.Text = tableItems [indexPath.Row];//.Items[indexPath.Row].Heading;

			// if it's a cell style that supports a subheading, set it
//			if(item.CellStyle == UITableViewCellStyle.Subtitle 
//				|| item.CellStyle == UITableViewCellStyle.Value1
//				|| item.CellStyle == UITableViewCellStyle.Value2)
//			{ cell.DetailTextLabel.Text = item.SubHeading; }

			// if the item has a valid image, and it's not the contact style (doesn't support images)
//			if(!string.IsNullOrEmpty(item.ImageName) && item.CellStyle != UITableViewCellStyle.Value2)
//			{
//				if(File.Exists(item.ImageName))
//					cell.ImageView.Image = UIImage.FromBundle(item.ImageName);
//			}

			// set the accessory
			cell.Accessory = UITableViewCellAccessory.DisclosureIndicator;

			return cell;
		}
开发者ID:RickySan65,项目名称:xamarin-forms-samples,代码行数:34,代码来源:NativeListViewSource.cs


示例3: GetCell

        public override UITableViewCell GetCell(UITableView tv)
        {
            var cell = tv.DequeueReusableCell (Key);
            if (cell == null){
                cell = new UITableViewCell (UITableViewCellStyle.Default, Key);
                cell.SelectionStyle = UITableViewCellSelectionStyle.None;
                cell.Frame = new RectangleF(cell.Frame.X, cell.Frame.Y, tv.Frame.Width, cell.Frame.Height);
            } else {
                RemoveTag (cell, 1);
            }

            if (button == null) {

                RectangleF frame = cell.Frame;
                frame.Inflate(-10, 0);

                button = new GlassButton(frame);
                button.TouchUpInside += (o, e) => tapped.Invoke();
                button.Font = UIFont.BoldSystemFontOfSize (22);
            } else {
                button.RemoveFromSuperview();
            }

            button.SetTitle(this.Caption, UIControlState.Normal);
            button.SetTitleColor(UIColor.White, UIControlState.Normal);
            button.BackgroundColor = UIColor.Clear;
            button.HighlightedColor = this.HighlightedColor;
            button.NormalColor = this.NormalColor;
            button.DisabledColor = this.DisabledColor;

            cell.Add(button);

            return cell;
        }
开发者ID:rsatter,项目名称:MonoCross,代码行数:34,代码来源:ButtonElement.cs


示例4: GetCell

		public override UITableViewCell GetCell (UITableView tv)
		{
			var cell = tv.DequeueReusableCell (CellKey);
			if (cell == null){
				cell = new UITableViewCell (UITableViewCellStyle.Default, CellKey);
				cell.SelectionStyle = UITableViewCellSelectionStyle.None;
			} else
				RemoveTag (cell, 1);

			SizeF captionSize = new SizeF (0, 0);
			if (Caption != null && ShowCaption){
				cell.TextLabel.Text = Caption;
				captionSize = cell.TextLabel.StringSize (Caption, UIFont.FromName (cell.TextLabel.Font.Name, UIFont.LabelFontSize));
				captionSize.Width += 10; // Spacing
			}

			if (slider == null){
				slider = new UISlider (new RectangleF (10f + captionSize.Width, 12f, 280f - captionSize.Width, 7f)){
					BackgroundColor = UIColor.Clear,
					MinValue = this.MinValue,
					MaxValue = this.MaxValue,
					Continuous = true,
					Value = this.Value,
					Tag = 1
				};
				slider.ValueChanged += delegate {
					Value = slider.Value;
				};
			} else {
				slider.Value = Value;
			}
			
			cell.ContentView.AddSubview (slider);
			return cell;
		}
开发者ID:henrikweimenhog,项目名称:MonoTouch.Dialog,代码行数:35,代码来源:FloatElement.cs


示例5: GetCell

		/// <summary>
		/// Called by the TableView to get the actual UITableViewCell to render for the particular row
		/// </summary>
		public override UITableViewCell GetCell (UITableView tableView, MonoTouch.Foundation.NSIndexPath indexPath)
		{
			// request a recycled cell to save memory
			UITableViewCell cell = tableView.DequeueReusableCell (cellIdentifier);

			// UNCOMMENT one of these to use that style
			var cellStyle = UITableViewCellStyle.Default;
//			var cellStyle = UITableViewCellStyle.Subtitle;
//			var cellStyle = UITableViewCellStyle.Value1;
//			var cellStyle = UITableViewCellStyle.Value2;

			// if there are no cells to reuse, create a new one
			if (cell == null) {
				cell = new UITableViewCell (cellStyle, cellIdentifier);
			}

			cell.TextLabel.Text = tableItems[indexPath.Row].Heading;
			
			// Default style doesn't support Subtitle
			if (cellStyle == UITableViewCellStyle.Subtitle 
			   || cellStyle == UITableViewCellStyle.Value1
			   || cellStyle == UITableViewCellStyle.Value2) {
				cell.DetailTextLabel.Text = tableItems[indexPath.Row].SubHeading;
			}
			
			// Value2 style doesn't support an image
			if (cellStyle != UITableViewCellStyle.Value2)
				cell.ImageView.Image = UIImage.FromFile ("Images/" +tableItems[indexPath.Row].ImageName);
			
			return cell;
		}
开发者ID:kiwchang,项目名称:Storyboard.Tabbar.EmbeddedTableview,代码行数:34,代码来源:TableSource.cs


示例6: GetCell

		public override UITableViewCell GetCell(UITableView tv)
		{
			var cell = tv.DequeueReusableCell(CellKey);
			if (cell == null)
			{
				cell = new UITableViewCell(UITableViewCellStyle.Default, CellKey);
				if ((Flags & CellFlags.Transparent) != 0)
				{
					cell.BackgroundColor = UIColor.Clear;

					// 
					// This trick is necessary to keep the background clear, otherwise
					// it gets painted as black
					//
					cell.BackgroundView = new UIView(RectangleF.Empty)
					{
						BackgroundColor = UIColor.Clear
					};
				}
				if ((Flags & CellFlags.DisableSelection) != 0)
					cell.SelectionStyle = UITableViewCellSelectionStyle.None;

				if (Caption != null)
					cell.TextLabel.Text = Caption;
				cell.ContentView.AddSubview(View);
			}
			return cell;
		}
开发者ID:moljac,项目名称:MonoMobile.Dialog,代码行数:28,代码来源:UIViewElement.MT.cs


示例7: GetCell

 public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
 {
     var cell = new UITableViewCell();
     var item = data[indexPath.Row];
     cell.TextLabel.Text = (item as SampleModel).Name;
     return cell;
 }
开发者ID:Esri,项目名称:arcgis-runtime-samples-xamarin,代码行数:7,代码来源:SamplesViewController.cs


示例8: GetCell

        public override UITableViewCell GetCell(Cell item, UITableViewCell reusableCell,
            UITableView tv)
        {
            var cell = base.GetCell(item, reusableCell, tv);
            switch (item.StyleId)
            {
                case "none":
                    cell.Accessory = UITableViewCellAccessory.None;
                    break;

                case "checkmark":
                    cell.Accessory = UITableViewCellAccessory.Checkmark;
                    break;

                case "detail-button":
                    cell.Accessory = UITableViewCellAccessory.DetailButton;
                    break;

                case "detail-disclosure-button":
                    cell.Accessory = UITableViewCellAccessory.DetailDisclosureButton;
                    break;

                case "disclosure":
                    cell.Accessory = UITableViewCellAccessory.DisclosureIndicator;
                    break;

                default:
                    cell.Accessory = UITableViewCellAccessory.None;
                    break;
            }
            return cell;
        }
开发者ID:MikeCodesDotNet,项目名称:Beer-Drinkin,代码行数:32,代码来源:CellAccessoryRenderer.cs


示例9: GetCell

		/// <summary>
		/// Called by the TableView to get the actual UITableViewCell to render for the particular row
		/// </summary>
		public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath)
		{
			// request a recycled cell to save memory
			UITableViewCell cell = tableView.DequeueReusableCell (cellIdentifier);
			// TODO: UNCOMMENT one of these to use that style
			var cellStyle = UITableViewCellStyle.Default;
			//var cellStyle = UITableViewCellStyle.Subtitle;
			//var cellStyle = UITableViewCellStyle.Value1;
			//var cellStyle = UITableViewCellStyle.Value2;

			// if there are no cells to reuse, create a new one

			if (cell == null) {
				cell = new UITableViewCell (cellStyle, cellIdentifier);
			}
			cell.TextLabel.Text = tableItems[indexPath.Row].Heading;
			cell.Accessory = UITableViewCellAccessory.DisclosureIndicator;
			cell.ImageView.Image= UIImage.FromFile ("Images/" +tableItems[indexPath.Row].ImageName);
			// Default style doesn't support Subtitle
			//			if (cellStyle == UITableViewCellStyle.Subtitle 
			//			   || cellStyle == UITableViewCellStyle.Value1
			//			   || cellStyle == UITableViewCellStyle.Value2) {
			//				cell.DetailTextLabel.Text = tableItems[indexPath.Row].SubHeading;
			//			}
			// Value2 style doesn't support an image
			if (cellStyle != UITableViewCellStyle.Value2)
				cell.ImageView.Image = UIImage.FromFile ("Images/" +tableItems[indexPath.Row].ImageName);
			//FitpulseTheme.Apply (cell);

			return cell;
		}
开发者ID:sakr2015,项目名称:eforsah_v1.1,代码行数:34,代码来源:CategoryTableSource.cs


示例10: GetCell

		public override UITableViewCell GetCell(Cell item, UITableViewCell reusableCell, UITableView tv)
		{
			var textCell = (TextCell)item;

			var tvc = reusableCell as CellTableViewCell;
			if (tvc == null)
				tvc = new CellTableViewCell(UITableViewCellStyle.Subtitle, item.GetType().FullName);
			else
				tvc.Cell.PropertyChanged -= tvc.HandlePropertyChanged;

			tvc.Cell = textCell;
			textCell.PropertyChanged += tvc.HandlePropertyChanged;
			tvc.PropertyChanged = HandlePropertyChanged;

			tvc.TextLabel.Text = textCell.Text;
			tvc.DetailTextLabel.Text = textCell.Detail;
			tvc.TextLabel.TextColor = textCell.TextColor.ToUIColor(DefaultTextColor);
			tvc.DetailTextLabel.TextColor = textCell.DetailColor.ToUIColor(DefaultDetailColor);

			WireUpForceUpdateSizeRequested(item, tvc, tv);

			UpdateIsEnabled(tvc, textCell);

			UpdateBackground(tvc, item);

			return tvc;
		}
开发者ID:Costo,项目名称:Xamarin.Forms,代码行数:27,代码来源:TextCellRenderer.cs


示例11: GetCell

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

            if(cell == null)
            {
                cell = new UITableViewCell(UITableViewCellStyle.Value1, kCellIdentifier);
            }

            int minutes = (list[indexPath.Row].arrivalTime.Subtract(DateTime.Now)).Minutes;

            string label = list[indexPath.Row].route.routeName + " " + list[indexPath.Row].destination.stationName;

            if(list[indexPath.Row].isApproaching) {
                label += " (A)";
            } else if(list[indexPath.Row].isDelayed) {
                label += " (D)";
            }

            cell.TextLabel.Text = label;

            cell.DetailTextLabel.Text = (minutes == 0) ? "Due" : (minutes + " " + (minutes > 1 ? "mins" : "min"));

            return cell;
        }
开发者ID:kkinnebrew,项目名称:transitapp,代码行数:25,代码来源:ArrivalTableViewDataSource.cs


示例12: WillDisplay

 public override void WillDisplay(UITableView tableView, UITableViewCell cell, NSIndexPath indexPath)
 {
     if (indexPath.Row == Entries.Count - 1) {
         GenerateEntries (25);
         tableView.ReloadData ();
     }
 }
开发者ID:seansparkman,项目名称:InfiniteScroll,代码行数:7,代码来源:InfiniteViewSource.cs


示例13: GetCell

        public override UITableViewCell GetCell(UITableView tableView, Foundation.NSIndexPath indexPath)
        {
            var tableCell = tableView.DequeueReusableCell (cellId);

            if (tableCell == null) {
                tableCell = new UITableViewCell (
                    UITableViewCellStyle.Subtitle,
                    cellId
                );
                tableCell.SelectionStyle = UITableViewCellSelectionStyle.Blue;
                if (tableCell.TextLabel != null) {
                    tableCell.TextLabel.TextColor = UIColor.White;
                }
                tableCell.BackgroundColor = UIColor.FromRGB (9, 34, 65);

                var backgroundView = new UIView ();
                backgroundView.BackgroundColor = UIColor.FromRGB (88, 181, 222);
                tableCell.SelectedBackgroundView = backgroundView;

                tableCell.Accessory = UITableViewCellAccessory.DisclosureIndicator;
                tableCell.TintColor = UIColor.White;
            }

            var entry = Entries [indexPath.Row];
            tableCell.TextLabel.Text = entry;

            return tableCell;
        }
开发者ID:seansparkman,项目名称:InfiniteScroll,代码行数:28,代码来源:InfiniteViewSource.cs


示例14: GetCell

 public override UITableViewCell GetCell(Cell item, UITableViewCell reusableCell, UITableView tv)
 {
     var obj = base.GetCell(item, reusableCell, tv);
     var cellEx = item as TextCellEx;
     if (!cellEx.IsShow)
     {
         obj.Accessory = UITableViewCellAccessory.None;
     }
     else
     {
         switch (cellEx.ShowIndicator)
         {
         case RightIndicator.Entry:
             obj.Accessory = UITableViewCellAccessory.DisclosureIndicator;
             break;
         case RightIndicator.Check:
             obj.Accessory = UITableViewCellAccessory.Checkmark;
             break;
         case RightIndicator.None:
             obj.Accessory = UITableViewCellAccessory.None;
             break;
         }
     }
     return obj;
 }
开发者ID:XZiar,项目名称:WordsLinks,代码行数:25,代码来源:CustomRenderer_iOS.cs


示例15: GetCell

        public override UITableViewCell GetCell(UITableView tv)
        {
            var cell = tv.DequeueReusableCell (cpkey);
            if (cell == null){
                cell = new UITableViewCell (UITableViewCellStyle.Subtitle, cpkey);
                cell.SelectionStyle = UITableViewCellSelectionStyle.None;
            } else
                RemoveTag (cell, 1);

            if (control == null)
            {
                if (colorSelections != null)
                {
                    control = new SegmentControl(colorSelections);
                    control.ColorSelected += delegate(UIColor selectedColor, UIColor previousColor) {
                        if (ColorSelected != null) ColorSelected(selectedColor);
                    };
                }
                else if (unselectedImages != null)
                {
                    control = new SegmentControl(unselectedImages, selectedImages);
                    control.ImageSelected += delegate(int imageIndex) {
                        if (ImageSelected != null) ImageSelected(imageIndex);
                    };
                }
            }
            else control.SetNeedsDisplay();

            cell.AccessoryView = control;
            cell.TextLabel.Text = Caption;

            return cell;
        }
开发者ID:rsatter,项目名称:MonoCross,代码行数:33,代码来源:SegmentElement.cs


示例16: GetCell

		/// <summary>
		/// Called by the TableView to actually build each cell. 
		/// </summary>
		public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath)
		{
			// declare vars
			NavItem navItem = navItems[indexPath.Section].Items[indexPath.Row];
			UIImage navIcon = null;
			
			var cell = tableView.DequeueReusableCell (cellIdentifier);
			if (cell == null)
			{
				cell = new UITableViewCell (UITableViewCellStyle.Default, cellIdentifier);
				cell.Tag = Environment.TickCount;
			}
			
			// set the cell properties
			cell.TextLabel.Text = navItems[indexPath.Section].Items[indexPath.Row].Name;
			cell.Accessory = UITableViewCellAccessory.DisclosureIndicator;
			
//			if (!String.IsNullOrEmpty (navItem.ImagePath))
//			{
//				navIcon = UIImage.FromFile (navItem.ImagePath);
//				if (navIcon != null)
//				{
//					navTableCellView.IconImage = navIcon;
//				}
//			}
			
			// return the cell
			return cell;
		}
开发者ID:Adameg,项目名称:mobile-samples,代码行数:32,代码来源:NavItemTableSource.cs


示例17: GetCell

 // Get the cell and add the disclosure indicator if the bindable property was set to true.
 public override UITableViewCell GetCell(Cell item,  UITableViewCell reusableCell, UITableView tv)
 {
     var cell = base.GetCell (item, reusableCell, tv);
     if( ( (DisclosureImageCell) item ).DisclosureEnabled)
         cell.Accessory = UITableViewCellAccessory.DisclosureIndicator;
     return cell;
 }
开发者ID:jfuji6,项目名称:XamarinDemo,代码行数:8,代码来源:DisclosureImageCellRenderer.cs


示例18: GetCell

 public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
 {
     var cell = new UITableViewCell (UITableViewCellStyle.Default, "PhotoCell");
     cell.ImageView.SetImage (new NSUrl (PhotoCells [indexPath.Row].thumbnailUrl), UIImage.FromBundle ("git"));
     cell.TextLabel.Text = PhotoCells [indexPath.Row].title;
     return cell;
 }
开发者ID:danstraughn,项目名称:XamarinMVVMLightTests,代码行数:7,代码来源:TableViewController.cs


示例19: WillDisplay

		async public override void WillDisplay(UITableView tableView, UITableViewCell cell, NSIndexPath indexPath)
		{
			if (cell.RespondsToSelector(new ObjCRuntime.Selector("setSeparatorInset:")))
			{
				cell.SeparatorInset = UIEdgeInsets.Zero;
			}
			if (cell.RespondsToSelector(new ObjCRuntime.Selector("setPreservesSuperviewLayoutMargins:")))
			{
				cell.PreservesSuperviewLayoutMargins = false;
			}
			if (cell.RespondsToSelector(new ObjCRuntime.Selector("setLayoutMargins:")))
			{
				cell.LayoutMargins = UIEdgeInsets.Zero;
			}

			if (Master.TailFetchingEnabled && indexPath.Row == Master.GetTableItemCount() - 1 && !Master.Fetching && Master.GetTableItemCount() > 0 && Master.NextAllowedTailFetch < DateTime.UtcNow)
			{
				UIView FooterLoadingView = new UIView(new CoreGraphics.CGRect(0, 0, UIScreen.MainScreen.Bounds.Size.Width, ((AppDelegate)UIApplication.SharedApplication.Delegate).TabBarController.TabBar.Frame.Size.Height + 60));
				UIActivityIndicatorView ai = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.Gray);
				ai.Frame = new CoreGraphics.CGRect(UIScreen.MainScreen.Bounds.Size.Width / 2 - 15, 15, 30, 30);
				ai.StartAnimating();
				FooterLoadingView.AddSubview(ai);
				tableView.TableFooterView = FooterLoadingView;
				Master.Offset = Master.GetTableItemCount();//Master.Offset + Master.Count;
				await Master.FetchTableData();
			}
		}
开发者ID:natevarghese,项目名称:XamarinTen,代码行数:27,代码来源:BaseTableViewDelegate.cs


示例20: GetCell

        public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
        {
            UITableViewCell cell;

            if (indexPath.Section == 0)
            {
                if (indexPath.Row == 0)
                {
                    var cellIdentifier = "Section1Row1";
                    cell = tableView.DequeueReusableCell(cellIdentifier);
                    if (cell == null)
                        cell = new UITableViewCell(UITableViewCellStyle.Default, cellIdentifier);

                    cell.TextLabel.Text = "帅酷天天东北烧烤";
                    cell.TextLabel.TextColor = UIColor.Gray;
                }
                else
                {
                    var cellIdentifier = "Section1Row2";
                    cell = tableView.DequeueReusableCell(cellIdentifier);
                    if (cell == null)
                        cell = new UITableViewCell(UITableViewCellStyle.Default, cellIdentifier);

                    cell.TextLabel.Text = "滨湖区蠡湖街道湖滨商业街8-19";
                    cell.TextLabel.TextColor = UIColor.Gray;
                    cell.TextLabel.Font = UIFont.SystemFontOfSize(12);
                }
            }
            else
            {
                cell = new UITableViewCell(UITableViewCellStyle.Default, "CategorySection");
            }

            return cell;
        }
开发者ID:oldmyezi,项目名称:dendrobiiwine,代码行数:35,代码来源:MerchantDetailViewController.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# UITableViewCellEditingStyle类代码示例发布时间:2022-05-24
下一篇:
C# UITableView类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap