使用 MonoTouch 为客户开发我的第一个 iPhone 应用程序时,我覆盖了 UITableViewDataSource.SectionIndexTitles
函数以提供一个包含我所想内容的 string[]
数组会使字母在垂直带中。
目前我面对的是工作索引带,但没有显示任何字符:
(我确实认为 UITableViewDataSource.SectionIndexTitles
具有本地对应的 sectionIndexTitlesForTableView
)。
我的问题:
有人可以提示我这里可能做错了什么吗?
我没有所有 A-Z 字符,但缺少一些字符,这可能是个问题?
最佳答案
这是 MonoTouch 中的错误。解决方法是在您的表源类中创建一个新方法并使用 Export
属性对其进行修饰,将 native ObjC 方法传递给重写 (sectionIndexTitlesForTableView:
):
string[] sectionIndexArray;
//..
[Export ("sectionIndexTitlesForTableView:")]
public NSArray SectionTitles (UITableView tableview)
{
return NSArray.FromStrings(sectionIndexArray);
}
关于c# - 为什么我在 UITableView 中有一个空的(但有效的)表索引带?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7539038/