Skip to content

Instantly share code, notes, and snippets.

@luiseduardohdbackup
Forked from brendanzagaeski/CustomRootElement.cs
Last active August 29, 2015 14:11
Show Gist options
  • Save luiseduardohdbackup/74dbad5eba5602970a44 to your computer and use it in GitHub Desktop.
Save luiseduardohdbackup/74dbad5eba5602970a44 to your computer and use it in GitHub Desktop.
using System;
using MonoTouch.Dialog;
using MonoTouch.UIKit;
using MonoTouch.Foundation;
namespace MTDialogViewControllerTest
{
public class CustomRootElement : RootElement
{
public CustomRootElement (string caption, Group group) : base (caption, group)
{
}
protected override UIViewController MakeViewController ()
{
return new CustomDialogViewController (this, true) {
Autorotate = true
};
}
}
public class CustomDialogViewController : DialogViewController
{
public CustomDialogViewController (RootElement root, bool pushing): base (root, pushing)
{
}
public override Source CreateSizingSource (bool unevenRows)
{
if (unevenRows)
throw new NotImplementedException ("You need to create a new SourceSizing subclass, this sample does not have it");
return new CustomSource (this);
}
public class CustomSource : DialogViewController.Source
{
public CustomSource (DialogViewController container) : base (container)
{
}
public override void WillDisplay (UITableView tableView, UITableViewCell cell, NSIndexPath indexPath)
{
base.WillDisplay (tableView, cell, indexPath);
if (indexPath.Row > maxRows - 20) {
loadMoreRows ();
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment