Sencha Touch Ext.navigation.View pop to root

Sencha Touch Ext.navigation.View pop to root(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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Update another component when Formik form changes(当Formik表单更改时更新另一个组件)
Formik validation isSubmitting / isValidating not getting set to true(Formik验证正在提交/isValiating未设置为True)
React Validation Max Range Using Formik(使用Formik的Reaction验证最大范围)
Validation using Yup to check string or number length(使用YUP检查字符串或数字长度的验证)
Updating initialValues prop on Formik Form does not update input value(更新Formik表单上的初始值属性不会更新输入值)
password validation with yup and formik(使用YUP和Formick进行密码验证)