Created
July 10, 2012 10:04
-
-
Save philcockfield/3082446 to your computer and use it in GitHub Desktop.
Deriving from Element
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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