我可以使用带有字母导航的 MonoTouch.Dialog 创建分段 UITableView 吗?
在 MonoTouch 中,我像这样创建分段的 UITableView:
public EntityDataSource(UIViewController controller)
{
_controller = controller;
this._entities = repository.GetEntities();
sectionTitles = (from r in _entities
orderby r.StartsWith
select r.StartsWith).Distinct().ToList();
foreach (var entity in _entities)
{
int sectionNumber = sectionTitles.IndexOf(entity.StartsWith);
if (sectionElements.ContainsKey(sectionNumber)) {
sectionElements[sectionNumber].Add(entity);
}
else {
sectionElements.Add(sectionNumber, new List<Entity>() {entity});
}
}
}
public override int NumberOfSections (UITableView tableView)
{
return sectionTitles.Count;
}
public override string TitleForHeader (UITableView tableView, int section)
{
return sectionTitles[section];
}
public override string[] SectionIndexTitles (UITableView tableView)
{
return sectionTitles.ToArray();
}
public override int RowsInSection (UITableView tableview, int section)
{
return sectionElements[section].Count();
}
我想用 MonoTouch.Dialog 做同样的事情。那可能吗?