我有一个 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
discord.js v12:我如何等待 DM 频道中的消息?discord.js v12: How do I await for messages in a DM channel?(discord.js v12:我如何等待 DM 频道中的消息?)
如何让我的机器人提及发出该机器人命令的人how to make my bot mention the person who gave that bot command(如何让我的机器人提及发出该机器人命令的人)
如何修复必须使用导入来加载 ES 模块 discord.jsHow to fix Must use import to load ES Module discord.js(如何修复必须使用导入来加载 ES 模块 discord.js)
如何列出来自特定服务器的所有成员?How to list all members from a specific server?(如何列出来自特定服务器的所有成员?)
Discord bot:修复“找不到 FFMPEG"Discord bot: Fix ‘FFMPEG not found’(Discord bot:修复“找不到 FFMPEG)
使用 discord.js 加入 discord 服务器时的欢迎消息Welcome message when joining discord Server using discord.js(使用 discord.js 加入 discord 服务器时的欢迎消息)