4

Consider something like this:

new RootElement ("Root"){
                          new Section ("Section A") {
                            new EntryElement("Element in A")
                          }
                          new Section ("Section B") {
                            new EntryElement("Element in B")
                          }
}

and Monotouch.Dialog will create you TableView with two sections. Now I want the second section to be located not right under the first section but rather at very bottom of the screen. How can I do that?

iLemming
  • 34,477
  • 60
  • 195
  • 309
  • I think you would have to hack the MT.D source to do that. This is fairly extreme edge case I wouldn't expect MT.D to handle. – Jason Nov 15 '11 at 21:38

2 Answers2

3

It seems you can trick Monotouch.Dialog by defining empty HeaderView for the section. It will expand the space between sections. Something like this:

lastSection.HeaderView = new UIView(new RectangleF(0,0,0,80));

I'm not sure though this is the right approach. Worked for me.

iLemming
  • 34,477
  • 60
  • 195
  • 309
1

I do not believe MonoTouch.Dialog can do this of the box. You will need to:

  1. Define a large transparent UITableViewCell subclass.
  2. Define an ‘Element’ subclass and override it’s GetCell(...) method to provide the cell you subclassed above.
  3. Implement IElementSizing on the element above and implement GetHeight(...) to describe the height of the transparent cell between the first and last cells.
  4. Create an empty Section with the Element subclass between your top EntryElement and the bottom EntryElement section.

The resulting code would look something like this:

this.Root = new RootElement ("Root") {
    new Section ("Section A") {
        new EntryElement("Element in A")
    }
    new Section("") {
        new EmptyElement()
    }
    new Section ("Section B") {
        new EntryElement("Element in B")
    }
};
Anuj
  • 3,134
  • 13
  • 17
  • actually I tricked MTD with defining section's HeaderView something like this: lastSection.HeaderView = new UIView(new RectangleF(0,0,0,80)); – iLemming Nov 15 '11 at 23:24