Xamarin.ios 单触式添加页脚

Xamarin.ios 单触式添加页脚,xamarin.ios,table-footer,Xamarin.ios,Table Footer,我正在尝试在表视图中添加带有按钮的页脚视图。我在网上找到了这个代码 public override UIView GetViewForFooter(UITableView tableView, int sectionIndex) { // Write a method to get the proper Section via the sectionIndex var section = GetSection(sectionIndex); if (section != null)

我正在尝试在表视图中添加带有按钮的页脚视图。我在网上找到了这个代码

public override UIView GetViewForFooter(UITableView tableView, int sectionIndex)
{
    // Write a method to get the proper Section via the sectionIndex
    var section = GetSection(sectionIndex);
if (section != null)
{
    if (section.FooterView == null && !string.IsNullOrEmpty(section.FooterText))
    {
             // Create your FooterView here 
        section.FooterView = CreateFooterView(tableView, section.FooterText);
    }

    return section.FooterView;
}

return null;
}
我不知道GetSection方法是什么?我遇到错误“当前上下文中不存在名称GetSection”

我在MonoTouch网站上也找不到任何合适的文档


非常感谢您的帮助。

您的示例代码可能是MonoTouch。对话框示例。如果您没有使用MonoTouch.Dialog,只需从该方法返回适当的UIView即可。比如:

public override UIView GetViewForFooter(UITableView tableView, int sectionIndex) {
    var myFooter = new UIView(); // Or some other class extending UIView, depending on what you want to do
    // Add SubViews and style the view
    return myFooter;
}

如果表视图中有多个节,则可以考虑
sectionIndex
参数,为每个节创建不同的页脚。有关更多信息,请检查

GetSection可能是您自己编写的方法,或者是您找到的示例中其他地方实现的方法。我同意我必须编写GetSection方法,但我不知道应该在其中编写什么。其他世界需要什么参数和返回什么。我们缺少一些上下文。您使用的是MonoTouch.Dialog吗?你在哪里找到了这个例子?我没有使用MonoTouch.Dialog。我想这和MonoTouch有关。对话,对吗?我想在没有单触的情况下完成对话。。。。