【发布时间】:2015-05-28 10:41:38
【问题描述】:
我有两层嵌套的 RootElement,两层都没有返回按钮。
两件事要弄清楚
- 是的,我正在覆盖 DialogViewController 并将“推送”设置为 True
- 我将 DialogViewController 的视图添加为 MvxViewController 中的 SubView,而不是使用 DialogViewController 作为我的主控制器
我的 ViewController 中有许多子视图,包括 UITableView 和自定义 UIView。我想使用 MT D 为我提供的嵌套 RootElements 的控制器的方便嵌套,因此我将 DialogViewController.View 作为子视图插入。
我以手写方式创建 RootElements 和 Sections
RootElement filtersListRootElement = new RootElement("Filters");
Section filterTypes = new Section();
RootElement filterRootElement = new RootElement("Filter Options");
RootElement byDateRoot = new RootElement("Date");
RootElement byCategoryRoot = new RootElement("Category");
filterRootElement.Add(new Section());
filterRootElement.Sections.First().Elements.Add(byDateRoot);
filterRootElement.Sections.First().Elements.Add(byCategoryRoot);
byDateRoot.Add(new Section("Some Stuff"));
byDateRoot.Sections.First().Elements.Add(new CheckboxElement("Yesterday"));
byDateRoot.Sections.First().Elements.Add(new CheckboxElement("Last Week"));
byDateRoot.Sections.First().Elements.Add(new CheckboxElement("Last 6 months"));
byDateRoot.Sections.First().Elements.Add(new CheckboxElement("2 years"));
byCategoryRoot.Add(new Section());
byCategoryRoot.Sections.First().Elements.Add(new CheckboxElement("Medications"));
byCategoryRoot.Sections.First().Elements.Add(new CheckboxElement("Lifestyle"));
byCategoryRoot.Sections.First().Elements.Add(new CheckboxElement("Tests"));
filterTypes.Elements.Add(filterRootElement);
filtersListRootElement.Sections.Add(filterTypes);
然后我像这样将 View 拉到我的主 ViewController 中
DialogViewController filtersListDvc =
new DialogViewController(UITableViewStyle.Plain, filtersListRootElement, true);
this.AddChildViewController(filtersListDvc);
this.View.AddSubview(filtersListDvc.View);
filtersListDvc.DidMoveToParentViewController(this);
这会按预期显示元素,我可以向下钻取每个 RootElement。然而,没有一个视图有后退按钮,我不明白为什么
【问题讨论】:
标签: mvvmcross monotouch.dialog