Monotouch Dialog. Section at any specific position on the screen

Consider the following:

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 a TableView with two sections. Now I want the second section to be located not under the first section, but at the very bottom of the screen. How can i do this?

+4
source share
2 answers

It seems you can fool Monotouch.Dialog by specifying an empty HeaderView section for this section. It will expand the space between sections. Something like that:

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

I am not sure, although this is the right approach. Worked for me.

+3
source

I don't think MonoTouch.Dialog can do this out of the box. You will need:

  • Define a large transparent subclass of UITableViewCell.
  • Define a subclass of "Element" and override its GetCell (...) method to provide the cell that you subclassed above.
  • Embed IElementSize above the element above and implement GetHeight (...) to describe the height of the transparent cell between the first and last cells.
  • Create an empty section with a subclass of Element between your upper EntryElement and the lower EntryElement.

The resulting code will 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") } }; 
+1
source

Source: https://habr.com/ru/post/1381348/


All Articles