本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例6: GetHeightTitle
public float GetHeightTitle(UITableView tableView)
{
var size2 = tableView.StringSize (_body ?? "", HeadingFont,
new SizeF(tableView.Frame.Width - 24, 280));
return size2.Height + 2;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}