I use Monotouch.Dialog and I have subclassed the Section class to implement a custom HeaderView. The problem is that the kind of header changes automatically, here is the code that I use:
public class MySection: Section
{
public MySection ()
{
UIView v = new UIView (new RectangleF (0,0,30,30));
v.BackgroundColor = UIColor.Red;
this.HeaderView = v;
}
}
I attached the screen:
http://imageshack.us/photo/my-images/864/capturedcran20120508212.png
EDIT
Ok i somehow found a way to solve this problem
The trick is to add a View, which will contain your real HeaderView, and set the AutosizesSubviews property to false. Then just add the view to the last:
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; } }
Ronny source share