Trying to create a simple table full of buttons, where the buttons are generated at run-time; the table appears, and has the right number of rows etc., but the rows appear to be empty.
public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath)
{
// The NavItem class is a "Josh Bloch enum" with n ordered members
NavItem item = NavItem.ByOrder(indexPath.Row);
var cell = tableView.DequeueReusableCell(item.Name);
if (cell == null)
{
cell = new UITableViewCell(UITableViewCellStyle.Default, item.Name);
UIButton button = UIButton.FromType(UIButtonType.RoundedRect);
button.SetTitle(item.Name, UIControlState.Normal);
cell.ContentView.AddSubview(button);
// cell.TextLabel.Text = item.Name;
// cell.Accessory = UITableViewCellAccessory.DisclosureIndicator;
}
return cell;
}
Without the buttons, the commented-out text-only version works fine.
I'm brand-new to iOS, so I assume there's something about component sizing or positioning or layout that I'm missing here -- anyone know what it is?