I am trying to add a Footer view with button in my table view. I found this code online
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;
}
I dont know what GetSection method is? I am having error "The name GetSection does not exist in the current context" .
I couldn't find any proper documentation on MonoTouch site as well.
Help is appreciated.
The example code you have is probably a MonoTouch.Dialog example. If you're not using MonoTouch.Dialog, simply return an appropriate UIView from this method. Something like:
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;
}
If you have more than one section in the table view, you can create different footers for each section by taking the sectionIndex
parameter into consideration. For more information, check the documentation