4

I'm using Monotouch.Dialog and I have subclassed the class Section to implement a custom HeaderView. The problem is that the header view is automatically resized, here's the code I'm using :

    public class MySection : Section
    {
        public MySection ()
        {
            UIView v = new UIView(new RectangleF(0,0,30,30));
            v.BackgroundColor = UIColor.Red;
            this.HeaderView = v;
        }
    }

I've attached the screen shot :
http://imageshack.us/photo/my-images/864/capturedcran20120508212.png



EDIT

Ok I've kind of find the way to resolve this

The trick is to add a View that will contain your real HeaderView and sets the AutosizesSubviews property to false. Then just add the view to the latest :

    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
  • 105
  • 7

0 Answers0