Sencha Touch Ext.navigation.View pop to root(Sencha Touch Ext.navigation.View pop to root)
问题描述
我有一个 Ext.navigation.View,我在其中推送了一些视图.某些用户交互要求我直接返回导航视图的顶层——相当于 iOS 中 UINavigationController 上的 popToRootViewControllerAnimated:.
I have an Ext.navigation.View in which I have pushed a few views. Certain user interactions require that I go directly back to the top level of the navigation view -- the equivalent of popToRootViewControllerAnimated: on a UINavigationController in iOS.
我尝试过各种方法,例如:
I have tried various things like:
while(navigationView.getItems().getCount() > 1)
navigationView.pop();
和
while(navigationView.canPop())
navigationView.pop();
都不行.第一个例子似乎让我陷入了无限循环,这并不奇怪.第二个例子似乎只弹出一个视图.
Neither work. The first example seems to put me into an infinite loop which isn't too surprising. The second example only seems to pop one view off.
所以问题是:在 Sencha Touch(版本 2 开发者预览版)中的 Ext.navigation.View 中弹出到根视图的正确方法是什么?
So the question: What is the proper way to pop to the root view in an Ext.navigation.View in Sencha Touch (version 2 developer preview)?
推荐答案
有许多临时方法可以实现这一目标.
There has been a number of interim methods for achieving this.
我使用的是弹出一个比你曾经拥有的级别数更高的数字,例如
The one I was using was to pop a number higher than the number of levels you would ever have e.g.
navigationView.pop(10);
效果很好,但我对此并不满意,但我看到他们现在引入了一种重置方法.你可以这样称呼它......
and that worked fine, but I was never happy with that, but I see they have now introduced a reset method. Which you can call thus...
navigationView.reset();
在 Sencha 源代码内部(见下文),您可以看到它与 @Mithralas 所说的工作类似,但更容易编写.
Internally within the Sencha source code (see below) you can see that it does a similar job to what @Mithralas said, but just easier to write.
// From the Sencha source code
this.pop(this.getInnerItems().length);
这篇关于Sencha Touch Ext.navigation.View pop to root的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Sencha Touch Ext.navigation.View pop to root
基础教程推荐
- 悬停时滑动输入并停留几秒钟 2022-01-01
- 角度Apollo设置WatchQuery结果为可用变量 2022-01-01
- Karma-Jasmine:如何正确监视 Modal? 2022-01-01
- 我什么时候应该在导入时使用方括号 2022-01-01
- 有没有办法使用OpenLayers更改OpenStreetMap中某些要素 2022-09-06
- 动态更新多个选择框 2022-01-01
- 在 JS 中获取客户端时区(不是 GMT 偏移量) 2022-01-01
- 当用户滚动离开时如何暂停 youtube 嵌入 2022-01-01
- 响应更改 div 大小保持纵横比 2022-01-01
- 在for循环中使用setTimeout 2022-01-01