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


C# UITableView.StringSize方法代码示例

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


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

示例1: ComputeEntryPosition

		// 
		// Computes the X position for the entry by aligning all the entries in the Section
		//
		SizeF ComputeEntryPosition (UITableView tv, UITableViewCell cell)
		{
			Section s = Parent as Section;
			if (s.EntryAlignment.Width != 0)
				return s.EntryAlignment;
			
			SizeF max = new SizeF (-1, -1);
			foreach (var e in s.Elements){
				var ee = e as MultilineEntryElement;
				if (ee == null)
					continue;
				
				SizeF size = new SizeF(0,0);
				if (!string.IsNullOrEmpty(ee.Caption)) 
				{ 
					size = tv.StringSize (ee.Caption, font); 
				}
				else
				{ 
					var useHeight = tv.StringSize (" ", font); 
					size = new SizeF(0, useHeight.Height);
				}
				if (size.Width > max.Width)
					max = size;				
			}

			if (max.Width > 0)
			{
				s.EntryAlignment = new SizeF (25 + Math.Min (max.Width, 160), max.Height);
			}
			else { s.EntryAlignment = new SizeF(2, max.Height); }

			return s.EntryAlignment;
		}
开发者ID:benhorgen,项目名称:MonoTouch.Dialog-AddOns,代码行数:37,代码来源:MultilineEntryElement.cs

示例2: GetHeight

		public virtual float GetHeight (UITableView tableView, NSIndexPath indexPath)
		{
			float margin = UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone ? 40f : 110f;
			SizeF maxSize = new SizeF (tableView.Bounds.Width - margin, float.MaxValue);
			
			if (this.Accessory != UITableViewCellAccessory.None)
				maxSize.Width -= 20;
			
			string c = Caption;
			string v = Value;
			// ensure the (multi-line) Value will be rendered inside the cell when no Caption is present
			if (String.IsNullOrEmpty (c))
				c = " ";

			var captionFont = Font ?? UIFont.BoldSystemFontOfSize (17);
			float height = tableView.StringSize (c, captionFont, maxSize, LineBreakMode).Height;
			
			if (!String.IsNullOrEmpty (v)) {
				var subtitleFont = SubtitleFont ?? UIFont.SystemFontOfSize (14);
				if (this.style == UITableViewCellStyle.Subtitle) {
					height += tableView.StringSize (v, subtitleFont, maxSize, LineBreakMode).Height;
				} else {
					float vheight = tableView.StringSize (v, subtitleFont, maxSize, LineBreakMode).Height;
					if (vheight > height)
						height = vheight;
				}
			}
			
			return height + 10;
		}
开发者ID:henrikweimenhog,项目名称:MonoTouch.Dialog,代码行数:30,代码来源:StyledMultilineElement.cs

示例3: GetHeight

        public float GetHeight(UITableView tableView, MonoTouch.Foundation.NSIndexPath indexPath)
        {
            var size = new SizeF(280, float.MaxValue);
            var titleHeight = tableView.StringSize(Caption, Font, size, UILineBreakMode.WordWrap).Height;
            var subTitleHeight = tableView.StringSize(Value, SubtitleFont, size, UILineBreakMode.WordWrap).Height;

            return titleHeight + subTitleHeight + 20;
        }
开发者ID:jorik041,项目名称:NycCodeCamp8,代码行数:8,代码来源:SessionElement.cs

示例4: GetHeight

		protected virtual float GetHeight(UITableView tableView) {
			float captionHeight = tableView.StringSize(Caption, VerticalLayoutCell.TextFont, VerticalLayoutCell.MaxCellSize).Height;
			if (!String.IsNullOrEmpty(Value)) {
				float valueHeight = tableView.StringSize(Value, VerticalLayoutCell.DetailTextFont, VerticalLayoutCell.MaxCellSize).Height;
				if (valueHeight > 0)
					captionHeight += (valueHeight + VerticalLayoutCell.Padding) ;
			}
			return captionHeight;
		}
开发者ID:cmckeegan,项目名称:MonoTouch.Dialog,代码行数:9,代码来源:VerticalLayoutElement.cs

示例5: GetHeight

		public float GetHeight (UITableView tableView, Foundation.NSIndexPath indexPath)
		{
			
			float captionHeight = tableView.StringSize(Caption, VerticalLayoutCell.TextFont, VerticalLayoutCell.MaxCellSize).Height;
			string summary = GetSummary(tableView);
			if (!String.IsNullOrEmpty(summary)) {
				float valueHeight = tableView.StringSize(summary, VerticalLayoutCell.DetailTextFont, VerticalLayoutCell.MaxCellSize).Height;
				if (valueHeight > 0)
					captionHeight += (valueHeight + VerticalLayoutCell.Padding) ;
			}
			return VerticalLayoutCell.BorderHeight + captionHeight + VerticalLayoutCell.BorderHeight;
		}
开发者ID:cmckeegan,项目名称:MonoTouch.Dialog,代码行数:12,代码来源:SummaryRootElement.cs

示例6: GetHeightTitle

        public float GetHeightTitle(UITableView tableView)
        {
            var size2 = tableView.StringSize (_body ?? "", HeadingFont,
                                              new SizeF(tableView.Frame.Width - 24, 280));

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

示例7: GetHeightForRow

 public override float GetHeightForRow(UITableView tableView, NSIndexPath indexPath)
 {
     var item = this.tableItems[indexPath.Row];
     SizeF sizeWidth = new SizeF(tableView.Bounds.Width - 40, float.MaxValue);
     float height = tableView.StringSize(item.Text, test.Font, sizeWidth, UILineBreakMode.WordWrap).Height + 40;
     return height;
 }
开发者ID:mukhtiarlander,项目名称:git_demo_torit,代码行数:7,代码来源:TopicPostsTableView.cs

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

示例9: GetCellHeightForRow

        public float GetCellHeightForRow(string cellText, UITableView tableView, NSIndexPath indexPath)
        {
            var font = GetFont(indexPath);
            var labelSize = tableView.StringSize(cellText, font, BaseSize, UILineBreakMode.WordWrap);

            // Return height plus padding for the top and bottom
            return CELL_PADDING + labelSize.Height + CELL_PADDING;
        }
开发者ID:alexyork,项目名称:NDC2010,代码行数:8,代码来源:NDC2010DetailsTableViewSource.cs

示例10: GetHeight

		public virtual float GetHeight (UITableView tableView, NSIndexPath indexPath)
		{
			SizeF maxSize = new SizeF (tableView.Bounds.Width-40, float.MaxValue);
			
			if (this.Accessory != UITableViewCellAccessory.None)
				maxSize.Width -= 20;
			
			var captionFont = Font ?? UIFont.BoldSystemFontOfSize (17);
			float height = tableView.StringSize (Caption, captionFont, maxSize, LineBreakMode).Height;
			
			if (this.style == UITableViewCellStyle.Subtitle){
				var subtitleFont = SubtitleFont ?? UIFont.SystemFontOfSize (14);
				height += tableView.StringSize (Value, subtitleFont, maxSize, LineBreakMode).Height;
			}
			
			return height + 10;
		}
开发者ID:modulexcite,项目名称:artapp,代码行数:17,代码来源:StyledMultilineElement.cs

示例11: GetHeightTitle

        public float GetHeightTitle(UITableView tableView)
        {
            float leftOffset = HasImage ? 58 : 18;

            var size2 = tableView.StringSize (_item.TitleDecoded, HeadingFont,
                                              new SizeF(tableView.Frame.Width - leftOffset - 18, 60));

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

示例12: GetHeight

		public virtual float GetHeight (UITableView tableView, NSIndexPath indexPath)
		{
			float margin = UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone ? 40f : 110f;
			SizeF size = new SizeF (tableView.Bounds.Width - margin, float.MaxValue);
			UIFont font = UIFont.BoldSystemFontOfSize (17);
			string c = Caption;
			// ensure the (single-line) Value will be rendered inside the cell
			if (String.IsNullOrEmpty (c) && !String.IsNullOrEmpty (Value))
				c = " ";
			return tableView.StringSize (c, font, size, UILineBreakMode.WordWrap).Height + 10;
		}
开发者ID:henrikweimenhog,项目名称:MonoTouch.Dialog,代码行数:11,代码来源:MultilineElement.cs

示例13: ComputeEntrySize

		public SizeF ComputeEntrySize(UITableView tableView)
		{
			SizeF size = new SizeF (320, float.MaxValue);
			
			var extraCaptionSpace = string.IsNullOrEmpty(Caption)? 0 : 20;
			
			if (string.IsNullOrEmpty(Value)) 
				return new SizeF(320, Font.LineHeight+25+extraCaptionSpace);
			
			return new SizeF(320, tableView.StringSize (Value, Font, size, UILineBreakMode.WordWrap).Height + 35 + extraCaptionSpace);
		}
开发者ID:goneflyin,项目名称:MonoMobile.Forms,代码行数:11,代码来源:MultilineEntryElement.cs

示例14: GetHeight

		public virtual float GetHeight (UITableView tableView, NSIndexPath indexPath)
		{
			if (this.AttributedText!=null && UIDevice.CurrentDevice.CheckSystemVersion(6,0)) {
				var sizeAttr = this.AttributedText.GetBoundingRect(new SizeF(270, int.MaxValue), NSStringDrawingOptions.UsesLineFragmentOrigin, new NSStringDrawingContext());
				return sizeAttr.Height + 20;
			}

			SizeF size = new SizeF (tableView.Frame.Width-40, float.MaxValue);
			var text = Caption;
			var size2 = tableView.StringSize (text, this.Font!=null? this.Font : UIFont.FromName ("Helvetica", 17f), size, LineBreakMode);
			return size2.Height + 20;
		}
开发者ID:escoz,项目名称:MonoMobile.Forms,代码行数:12,代码来源:StyledMultilineElement.cs

示例15: GetHeightDetails

        public float GetHeightDetails(UITableView tableView)
        {
            if (string.IsNullOrEmpty (_item.BodyDecoded))
                return 0;

            float leftOffset = HasImage ? 58 : 18;

            var size = tableView.StringSize (_item.BodyDecoded, DetailsFont,
                                             new SizeF(tableView.Frame.Width - leftOffset - 18, 50));

            return size.Height;
        }
开发者ID:jivkopetiov,项目名称:StackApp,代码行数:12,代码来源:InboxRow.cs


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