/
SpecCell1.cs
executable file
·77 lines (59 loc) · 2 KB
/
SpecCell1.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
using Foundation;
using System;
using UIKit;
using AircraftForSale.PCL;
namespace AircraftForSale
{
public partial class SpecCell1 : UITableViewCell
{
public SpecCell1 (IntPtr handle) : base (handle)
{
}
public override void AwakeFromNib()
{
// Called when loaded from xib or storyboard.
var device = UIDevice.CurrentDevice;
if (device.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone)
{
//var font = UIFont.SystemFontOfSize(17);
//this.SpecNameLabel.Font = UIFont.BoldSystemFontOfSize(17);
//this.SpecValueLabel.Font = UIFont.SystemFontOfSize(17);
//NameValueSpacingConstraint.Constant = 10;
}
}
public nfloat rowheight
{
get;
set;
}
public nfloat UpdateCell(string item)
{;
this.SpecValueLabel.Text = item;
this.SpecValueLabel.TextColor = UIColor.White;
this.SpecValueLabel.Lines = 0;
this.SpecValueLabel.LineBreakMode = UILineBreakMode.WordWrap;
var font = UIFont.SystemFontOfSize(UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad ? 20 : 17);
this.SpecValueLabel.Font = font;
//var section = keys[indexPath.Section];
if (item!=null && item.Length > 0)
{
float width = (float)this.SpecValueLabel.Frame.Width;
CoreGraphics.CGPoint points = new CoreGraphics.CGPoint();
points.X = this.SpecValueLabel.Frame.X;
points.Y = this.SpecValueLabel.Frame.Y;
var labelFrame = new CoreGraphics.CGRect(points, ((NSString)this.SpecValueLabel.Text).GetBoundingRect(
new CoreGraphics.CGSize(width, nfloat.MaxValue),
NSStringDrawingOptions.UsesLineFragmentOrigin,
new UIStringAttributes { Font = this.SpecValueLabel.Font }, null).Size);
labelFrame.Width = width;
this.SpecValueLabel.Frame = labelFrame;
return labelFrame.Height;
}
return 0f;
}
public void UpdateCell(SpecField item)
{
this.SpecValueLabel.Text = item.FieldName +": "+item.FieldValue;
}
}
}