0

テーブル ビューにボタン付きのフッター ビューを追加しようとしています。このコードをオンラインで見つけました

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 サイトにも適切なドキュメントが見つかりませんでした。

助けていただければ幸いです。

4

1 に答える 1

0

あなたが持っているコード例は、おそらく MonoTouch.Dialog の例です。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テーブル ビューに複数のセクションがある場合は、パラメーターを考慮して、セクションごとに異なるフッターを作成できます。詳細については、ドキュメントを確認してください

于 2013-03-28T17:36:45.263 に答える