升级到 MT 4.0 后不显示索引表视图 [英] Indexed TableViews not displaying after upgrade to MT 4.0

查看:18
本文介绍了升级到 MT 4.0 后不显示索引表视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

升级到 MT 4.0 后,我以前在右侧边框上显示索引的 TableView 不再有效.tableview 仍然分部分显示并正常工作,但索引没有显示.

After upgrading to MT 4.0, my TableViews that previously were displaying indexes on the right hand border are no longer working. The tableview still displays in sections and works properly, but the index is not displaying.

我在 UITableViewSource 中定义了这三个方法,并且这三个方法似乎都在工作:

I have these three methods defined in my UITableViewSource, and all three appear to be working:

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 的错误吗?

Is anyone else having this problem? Is this a bug with MT 4.0?

推荐答案

这是一个已知错误.

看来 UITableView 没有保留返回的数组,可以使用在我们进一步调查时,以下内容可以解决此问题:

It appears that UITableView is not retaining the returned array, you can use the following to work around this issue while we investigate it further:

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;
}

这篇关于升级到 MT 4.0 后不显示索引表视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆