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

C# UITableView类代码示例

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

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



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

示例1: GetCell

		public override UITableViewCell GetCell(UITableView tv)
		{
			RectangleF frame;
			if (datePicker == null)
			{
				label = new UILabel
				{
					Text = Caption
				};
				label.SizeToFit();
				frame = label.Frame;
				frame.X = 15;
				frame.Y = 5;
				label.Frame = frame;

				datePicker = CreatePicker();
				
			}
			if(datePicker.Date != DateValue)
				datePicker.Date = DateValue;

			frame = datePicker.Frame;
			frame.Y = frame.X = 0;
			datePicker.Frame = frame;
			var cell = tv.DequeueReusableCell("datePicker") ?? new UITableViewCell(UITableViewCellStyle.Default, "datePicker") { Accessory = UITableViewCellAccessory.None };
			cell.ContentView.Add(label);
			if(cell.ContentView != datePicker.Superview)
				cell.ContentView.Add(datePicker);
			
			return cell;
		}
开发者ID:stecenko,项目名称:MyCompany,代码行数:31,代码来源:DateTimeElement.cs


示例2: ViewDidLoad

        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();
            var list = new List<NewsModel>();
            var table = new UITableView (new RectangleF (0, 0, View.Bounds.Width, View.Bounds.Height));
            View.Add (table);

            try{
                var request = WebRequest.Create("http://api.bbcnews.appengine.co.uk/stories/"+_category);
                var response = request.GetResponse ();
                using(var stream = new StreamReader(response.GetResponseStream())){
                    var json = stream.ReadToEnd ();
                    var jsonVal = JsonValue.Parse (json);
                    for(var i=0; i<jsonVal["stories"].Count; i++){
                        list.Add (new NewsModel () {
                            Title = jsonVal["stories"][i]["title"],
                            Description = jsonVal["stories"][i]["description"],
                            Thumbnail = jsonVal["stories"][i]["thumbnail"],
                            Link = jsonVal["stories"][i]["link"]
                        });
                    }
                };
                response.Close ();
            }catch{
            }
            table.Source = new NewsTableSource(list.ToArray(), NavigationController);
            // Perform any additional setup after loading the view, typically from a nib.
        }
开发者ID:ferrodox,项目名称:knowledges-sharing,代码行数:28,代码来源:NewsController.cs


示例3: GetHeightForRow

		public override nfloat GetHeightForRow (UITableView tableView, Foundation.NSIndexPath indexPath)
		{
			if (!data.IsList && indexPath.Section == 0) {
				return indexPath.Row == 0 ? 66.0f : 22.0f;
			}
			return 44.0f;
		}
开发者ID:mono,项目名称:Continuous,代码行数:7,代码来源:ObjectInspector.cs


示例4: GetCell

		public override UITableViewCell GetCell (UITableView tableView, Foundation.NSIndexPath indexPath)
		{
			var item = Data[indexPath.Row];

			var cell = (ByInvestmentTableViewCell)tableView.DequeueReusableCell (investmentId);

			if (cell == null)
				cell = new ByInvestmentTableViewCell (investmentId, sourceNames);	

			//cell.SeparatorInset = new UIEdgeInsets (0, 0, 0, 10);

			cell.FundNameLabel.Text = item.FundName;
			cell.SelectionStyle = UITableViewCellSelectionStyle.None;

			var x = 0;

			foreach (var name in sourceNames) {
				cell.SourceAmounts [x].Item1.Text = name;

				var amount = 0.00;

				if (item.SourceAmounts.ContainsKey (name)) {
					amount = item.SourceAmounts [name];
				}
				cell.SourceAmounts [x].Item2.Text = String.Format ("{0:C}", amount);
				x++;
			}
			return cell;
		}
开发者ID:KiranKumarAlugonda,项目名称:TXTSHD,代码行数:29,代码来源:ByInvestmentTableViewSource.cs


示例5: GetCell

        public override UITableViewCell GetCell (UITableView tv)
        {
            var cell = tv.DequeueReusableCell(CellReuseIdentifier) as OwnerDrawnCell;

            if (cell == null)
            {
                cell = new OwnerDrawnCell(this, Style, CellReuseIdentifier);
                OnCreateCell(cell);
            }
            else
            {
                cell.Element = this;
            }

            if (Tapped != null) {
                cell.Accessory = UITableViewCellAccessory.DisclosureIndicator;
                cell.SelectionStyle = UITableViewCellSelectionStyle.Blue;
            } 
            else 
            {
                cell.Accessory = UITableViewCellAccessory.None;
                cell.SelectionStyle = UITableViewCellSelectionStyle.None;
            }

            cell.BackgroundColor = BackgroundColor;
            cell.Update();
            return cell;
        }   
开发者ID:Jeff-Lewis,项目名称:CodeBucket,代码行数:28,代码来源:CustomElement.cs


示例6: Selected

		public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
		{
			Value = !Value;
			InitializeCell(tableView);

			base.Selected(dvc, tableView, path);
		}
开发者ID:briandonahue,项目名称:MonoTouch.MVVM,代码行数:7,代码来源:CheckboxElement.cs


示例7: GetHeightTitle

        public float GetHeightTitle(UITableView tableView)
        {
            var size2 = tableView.StringSize (_post.TitleDecoded, HeadingFont,
                                              new SizeF(tableView.Frame.Width - 24, 60));

            return size2.Height + 2;
        }
开发者ID:jivkopetiov,项目名称:StackApp,代码行数:7,代码来源:QuestionListRow.cs


示例8: CommitEditingStyle

 public override void CommitEditingStyle(UITableView tableView, UITableViewCellEditingStyle editingStyle, NSIndexPath indexPath)
 {
     if (editingStyle == UITableViewCellEditingStyle.Delete) {
         _taskManager.RemoveItem(_taskManager.TodoItems[indexPath.Row]);
         tableView.DeleteRows(new NSIndexPath[] { indexPath }, UITableViewRowAnimation.Top);
     }
 }
开发者ID:phamthangnd,项目名称:TIG-CrossPlatformMobile,代码行数:7,代码来源:TasksTableViewSource.cs


示例9: GetHeightForHeader

		public override float GetHeightForHeader (UITableView tableView, int section)
		{
			if(section > 0)
				return 0.0f;
			
			return 160f;
		}
开发者ID:TheGiant,项目名称:Jaktloggen,代码行数:7,代码来源:UploadDataTableSource.cs


示例10: EditingStyleForRow

		public override UITableViewCellEditingStyle EditingStyleForRow (UITableView tableView, NSIndexPath indexPath)
		{
			var artsInSection = JaktLoggApp.instance.ArtList.Where(a => a.GroupId == 100).Count();
			if(indexPath.Section == 0 && indexPath.Row == artsInSection)
			    return UITableViewCellEditingStyle.Insert;
			return UITableViewCellEditingStyle.Delete;
		}
开发者ID:darkwood,项目名称:Jaktloggen,代码行数:7,代码来源:ArterTableSource.cs


示例11: GetCell

		public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath)
		{
			var cell = tableView.DequeueReusableCell("ArterTableCell");
			if(cell == null)
				cell = new UIJaktTableViewCell(UITableViewCellStyle.Default, "ArterTableCell");

			var groupId = JaktLoggApp.instance.ArtGroupList[indexPath.Section].ID;
			var artsInSection = JaktLoggApp.instance.ArtList.Where(a => a.GroupId == groupId);
			var c = artsInSection.Count();
			//legg til art - knapp
			if(_controller.TableView.Editing && groupId == 100 && indexPath.Row == c){
				cell.TextLabel.Text = Utils.Translate("specie.new");
				//cell.Accessory = UITableViewCellAccessory.None;
				cell.ImageView.Image = null;
			}
			else
			{
				var art = artsInSection.ElementAt(indexPath.Row);
				var label = art.Navn;

				var icon = JaktLoggApp.instance.SelectedArtIds.Contains(art.ID) ? "icon_checked.png" : "icon_unchecked.png";
				var file = "Images/Icons/"+icon;
				cell.ImageView.Image = new UIImage(file);
				cell.ImageView.Layer.MasksToBounds = true;
				cell.ImageView.Layer.CornerRadius = 5.0f;

				cell.TextLabel.Text = label;
				cell.TextLabel.TextAlignment = UITextAlignment.Left;
				if(!EditMode)
					cell.Accessory = UITableViewCellAccessory.DetailDisclosureButton;
			}
			return cell;
		}
开发者ID:darkwood,项目名称:Jaktloggen,代码行数:33,代码来源:ArterTableSource.cs


示例12: GetCell

		public override UITableViewCell GetCell (UITableView tv)
		{
			var cell = base.GetCell (tv);
			if (this.IsMandatory)
				cell.TextLabel.Text += "*";
			return cell;
		}
开发者ID:ClusterReplyBUS,项目名称:MonoTouch.Dialog,代码行数:7,代码来源:SelectableMultilineEntryElement.cs


示例13: Selected

		public override void Selected (DialogViewController dvc, UITableView tableView, NSIndexPath path)
		{
			if (IsReadonly) {
				base.Selected (dvc, tableView, path);
				return;
			}

			var controller = new UIViewController ();

			UITextView disclaimerView = new UITextView (controller.View.Frame);
//			disclaimerView.BackgroundColor = UIColor.FromWhiteAlpha (0, 0);
//			disclaimerView.TextColor = UIColor.White;
//			disclaimerView.TextAlignment = UITextAlignment.Left;
			if (!string.IsNullOrWhiteSpace (Value))
				disclaimerView.Text = Value;
			else
				disclaimerView.Text = string.Empty;
			
			disclaimerView.Font = UIFont.SystemFontOfSize (16f);
			disclaimerView.Editable = true;

			controller.View.AddSubview (disclaimerView);
			controller.NavigationItem.Title = Caption;
			controller.NavigationItem.RightBarButtonItem = new UIBarButtonItem (string.IsNullOrEmpty (_saveLabel) ? "Save" : _saveLabel, UIBarButtonItemStyle.Done, (object sender, EventArgs e) => {
				if (OnSave != null)
					OnSave (this, EventArgs.Empty);
				controller.NavigationController.PopViewControllerAnimated (true);
				Value = disclaimerView.Text;
			});	

			dvc.ActivateController (controller);
		}
开发者ID:ClusterReplyBUS,项目名称:MonoTouch.Dialog,代码行数:32,代码来源:SelectableMultilineEntryElement.cs


示例14: CreateCell

        protected override StandardContentCell CreateCell(UITableView tableView)
        {
            var cell = new StandardContentCell(UITableViewCellStyle.Default, Type);
            cell.SelectionStyle = UITableViewCellSelectionStyle.None;

            button = UIButton.FromType (UIButtonType.Custom);

            button.SetTitle (Text, UIControlState.Normal);
            button.Font = UIFont.BoldSystemFontOfSize (16);
            button.BackgroundColor = BackgroundColor;
            button.TitleEdgeInsets = new UIEdgeInsets(0, 6, 0, 6);
            button.Layer.CornerRadius = 7.0f;
            button.SetTitleColor(TextColor, UIControlState.Normal);
            button.SizeToFit ();
            button.TouchUpInside += delegate {
                RowSelectedImpl (tableView);
            };

            if (Disable) {
                button.UserInteractionEnabled = false;
                button.Enabled = false;
                button.TitleLabel.Enabled = false;
            }

            float left = (tableView.Frame.Width - button.Frame.Width ) / 2 - 12;
            button.Frame = new RectangleF(left, 4, button.Frame.Width + 12, 36);

            cell.ContentView.Add (button);

            return cell;
        }
开发者ID:jivkopetiov,项目名称:StackApp,代码行数:31,代码来源:ContentRows.cs


示例15: InitializeCell

		public override void InitializeCell(UITableView tableView)
		{
			Cell.Accessory = UITableViewCellAccessory.DisclosureIndicator;
			TextLabel.Text = Caption;
		
			base.InitializeCell(tableView);
		}
开发者ID:vknair74,项目名称:MonoMobile.Views,代码行数:7,代码来源:MapViewElement.cs


示例16: Selected

        public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath indexPath)
        {
            var root = (RootElement)Parent.Parent;
            root.RadioSelected = RadioIdx;

            base.Selected(dvc, tableView, indexPath);
        }
开发者ID:MvvmCross,项目名称:MvvmCross,代码行数:7,代码来源:RadioElement.cs


示例17: Selected

		public override void Selected (DialogViewController dvc, UITableView tableView, NSIndexPath path)
		{
			Value = !Value;
			var cell = tableView.CellAt (path);
			ConfigCell (cell);
			base.Selected (dvc, tableView, path);
		}
开发者ID:henrikweimenhog,项目名称:MonoTouch.Dialog,代码行数:7,代码来源:CheckboxElement.cs


示例18: RowSelected

		public override void RowSelected (UITableView tableView, NSIndexPath indexPath)
		{
			UIAlertController okAlertController = UIAlertController.Create ("Row Selected", indexedTableItems [keys [indexPath.Section]] [indexPath.Row], UIAlertControllerStyle.Alert);
			okAlertController.AddAction (UIAlertAction.Create ("OK", UIAlertActionStyle.Default, null));
			owner.PresentViewController (okAlertController, true, null);
			tableView.DeselectRow (indexPath, true);
		}
开发者ID:ezeh2,项目名称:ezeh2.github.io,代码行数:7,代码来源:IndexedTableSource.cs


示例19: ViewDidLoad

 public override void ViewDidLoad()
 {
     base.ViewDidLoad();
     table = new UITableView(View.Bounds); // defaults to Plain style
     table.Source = new TableSource(eventList);
     Add(table);
 }
开发者ID:ititwcip,项目名称:ITWCIPApplication,代码行数:7,代码来源:RecentEventsController.cs


示例20: TogglePicker

		private void TogglePicker(DialogViewController dvc, UITableView tableView, NSIndexPath path)
		{
			var sectionAndIndex = GetMySectionAndIndex(dvc);
			if(sectionAndIndex.Key != null)
			{
				Section section = sectionAndIndex.Key;
				int index = sectionAndIndex.Value;

				var cell = tableView.CellAt(path);

				if(isPickerPresent)
				{
					// Remove the picker.
					cell.DetailTextLabel.TextColor = UIColor.Gray;
					section.Remove(datePickerContainer);
					isPickerPresent = false;
				} 
				else
				{
					// Show the picker.
					cell.DetailTextLabel.TextColor = UIColor.Red;
					datePickerContainer = new UIViewElement(string.Empty, datePicker, false);
					section.Insert(index + 1, UITableViewRowAnimation.Bottom, datePickerContainer);
					isPickerPresent = true;
				}
			}
		}
开发者ID:ClusterReplyBUS,项目名称:MonoTouch.Dialog,代码行数:27,代码来源:TaggedDateElement.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# UITableViewCell类代码示例发布时间:2022-05-24
下一篇:
C# UITable类代码示例发布时间: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