升级到 MT 4.0 后,以前在右侧边框上显示索引的 TableView 不再工作。表视图仍按部分显示并正常工作,但未显示索引。
我在 UITableViewSource 中定义了这三种方法,并且这三种方法似乎都有效:
public override string[] SectionIndexTitles(UITableView tableView)
public override int SectionFor(UITableView tableView, string Title, int atIndex)
public override string TitleForHeader(UITableView tableView, int section)
还有其他人遇到这个问题吗?这是 MT 4.0 的错误吗?
这是一个已知错误 https://bugzilla.novell.com/show_bug.cgi?id=684281.
看来 UITableView 没有保留返回的数组,您可以使用
在我们进一步调查该问题时,可以采取以下措施解决此问题:
NSArray array;
[Export ("sectionIndexTitlesForTableView:")]
public NSArray SectionTitles (UITableView tableview)
{
if (array == null) {
string[] titles = new string[RowsInSection(tableview, 0)];
for (int index = 0; index < titles.Length; index++)
titles[index] = index.ToString();
array = NSArray.FromStrings (titles);
}
return array;
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)