Skip to content

Instantly share code, notes, and snippets.

@philcockfield
Created July 10, 2012 10:04
Show Gist options
  • Save philcockfield/3082446 to your computer and use it in GitHub Desktop.
Save philcockfield/3082446 to your computer and use it in GitHub Desktop.
Deriving from Element
public class FooCell : UITableViewCell
{
public const string KEY = "FooKey";
public event EventHandler<EventArgs> Tapped;
public FooCell() : base(UITableViewCellStyle.Subtitle, KEY)
{
}
public override void TouchesEnded(NSSet touches, UIEvent evt)
{
if (Tapped != null) Tapped(this, new EventArgs());
base.TouchesEnded(touches, evt);
}
}
public class MyElement : Element
{
public override UITableViewCell GetCell(UITableView tableView)
{
var cell = (tableView.DequeueReusableCell (FooCell.KEY) ?? new FooCell()) as FooCell;
cell.TextLabel.Text = "Foo";
cell.DetailTextLabel.Text = "Bar";
return cell;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment