切换视图超音速

Switch view supersonic

我正在开发 cross-platform 使用超音速的应用程序。但是,我相信我在理解 Supersonic 如何在内部管理视图时遇到了问题。

首先我不想使用原生导航栏,因为它不支持标题内的图像,比如公司的标志。这就是我不想将视图推送到视图堆栈的方式(因为它会自动添加 < 后退按钮)。

我的问题是:如何在 appgyver 的超音速中切换视图而不将其推入视图堆栈?类似于选项卡,但没有选项卡界面。可能吗?

也许我应该使用不同的移动网络应用程序框架?

您可以通过 this method:

移除原生导航栏
supersonic.ui.navigationBar.hide(options).then( function() {
    supersonic.logger.debug("Navigation bar hidden without animation.");
});

还有一个隐藏导航栏的建议,这样它就不会在屏幕上闪烁 found here:

Navigation Bar not hiding I have noticed that a lot of the times, the bar won't be hidden because the call has been made before the view has finished loading, resulting in an error, and the bar not hiding .

Quick Fix: You need a way to tell the view that it has finished loading. How do we do that ? window.post()

On the original view, in any controller, add the following code

$scope.broadcastMessage = function(msg){

    var message = {
        recipient: "hideView",
        message: "Hi Hide view!"
    };

    window.postMessage(message);
});

In your second view, do the same, but use the following code

function messageReceived(event) {

    // check that the message is intended for us
    if (event.data.recipient === "showView") {
        steroids.view.navigationBar.hide(); 
    }
}
window.addEventListener("message", messageReceived);

That will make sure the call is not made until after the view has received the message (which it won't until after it has loaded)

这意味着将视图推送到堆栈将不会提供本机导航栏,您可以添加自己的导航栏并根据需要设置样式。这是目前使用 Supersonic 的一种非常常见的方法。

如果您使用的是选项卡,则每个选项卡都有自己的视图堆栈。

为了回答您的问题,没有办法让视图不被推送到堆栈。解决这个问题非常简单。您也可以使用 modals。同样,要根据需要设置导航栏样式,您需要创建自己的导航栏并隐藏本机导航栏。

这个框架值得一试。我现在已经用它构建了许多应用程序。