【发布时间】:2012-03-16 10:22:03
【问题描述】:
在我正在构建的应用程序中,我使用以下模式:如果用户单击分层导航元素,我会立即打开下一个 UIViewController,它会自行加载数据并显示加载微调器(如果是)通过网络。
现在大多数列表视图都是使用MonoTouch 创建的。在一个 DialogViewController 上,我在屏幕显示后向视图 RootElement 添加许多元素时遇到问题。
一开始StringElements 在屏幕上看起来很好,但如果你快速上下滚动,每一行的文本就会变成一个块:
重现问题的代码:
var root = new RootElement("Root");
var dvc = new DialogViewController(root) { AutoHideSearch = true, EnableSearch = true };
nav.PushViewController(dvc, true);
Task.Factory.StartNew(() => {
Thread.Sleep(TimeSpan.FromSeconds(1));
UIApplication.SharedApplication.InvokeOnMainThread(() => {
var sec = new Section();
for (int i = 0; i < 100; i++)
{
var el = new StyledStringElement("Test", "Test", UITableViewCellStyle.Value1);
sec.Add(el);
}
root.Add(sec);
});
});
有趣的是,只有左边的字符串看起来像一个块,而右边的字符串很好。另外,在他们的 MWC(演示)应用程序中,Xamarin created a new RootElement to repopulate the twitter list as well。
【问题讨论】:
标签: ios xamarin.ios monotouch.dialog