4

考虑这样的事情:

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

Monotouch.Dialog 将为您创建包含两个部分的 TableView。现在我希望第二部分不位于第一部分的正下方,而是位于屏幕的最底部。我怎样才能做到这一点?

4

2 回答 2

3

看来您可以通过为该部分定义空的 HeaderView 来欺骗 Monotouch.Dialog。它将扩大部分之间的空间。像这样的东西:

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

我不确定这是正确的方法。为我工作。

于 2011-11-17T17:13:47.090 回答
1

我不相信 MonoTouch.Dialog 可以做到这一点。您将需要:

  1. 定义一个大的透明 UITableViewCell 子类。
  2. 定义一个“元素”子类并覆盖它的 GetCell(...) 方法以提供您在上面子类化的单元格。
  3. 在上面的元素上实现 IElementSizing 并实现 GetHeight(...) 来描述第一个和最后一个单元格之间的透明单元格的高度。
  4. 在顶部的 EntryElement 和底部的 EntryElement 部分之间创建一个带有 Element 子类的空部分。

生成的代码如下所示:

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")
    }
};
于 2011-11-15T21:44:06.987 回答