我正在使用Monotouch.Dialog和
我已经将类子类子类化为实现自定义HeaderView。问题是标题视图会自动调整大小,这是我正在使用的代码:
public class MySection : Section { public MySection () { UIView v = new UIView(new RectangleF(0,0,30,30)); v.BackgroundColor = UIColor.Red; this.HeaderView = v; } }
EDIT
好的我有点找到解决这个问题的方法
诀窍是添加一个包含真实HeaderView的View,并将AutosizesSubviews属性设置为false。然后只需将视图添加到最新的:
public class MySection : Section
{
public MySection ()
{
UIView v0 = new UIView(new RectangleF(0,0,50, 60));
v0.AutosizesSubviews = false;
UIView v = new UIView(new RectangleF(0,0,30,30));
v.BackgroundColor = UIColor.Red;
v0.AddSubview(v);
this.HeaderView = v0;
}
}