【发布时间】:2012-04-24 21:12:19
【问题描述】:
我正在使用 MT.D 在 DialogViewController 中列出人员。 EnableSearch 已打开,您可以过滤列表中的项目。但是,如果你推到另一个视图,然后回来,搜索栏是空的。我能够通过覆盖 OnSearchTextChanged (string text) 并将字符串存储到本地字段来恢复使用的搜索查询,当视图重新成为焦点时,我使用以下代码:
public override ViewDidAppear (bool animated)
{
base.ViewDidAppear (animated);
if (EnableSearch && !string.IsNullOrWhiteSpace (lastSearchQuery))
{
this.SearchButtonClicked (lastSearchQuery); // this inserts text
this.StartSearch (); // no clue what this is doing
this.ReloadData (); // does nothing but was worth a try
}
}
该代码将文本插入搜索栏中并显示它,但除非您输入某些内容,否则我无法过滤它。键盘出现在视野中,并且有一个搜索按钮,但它什么也没做。有什么建议么?
【问题讨论】:
标签: c# xamarin.ios monotouch.dialog