如何隐藏/删除Ionic 4 Cordova Windows 10应用程序后退按钮? [英] How to hide/remove Ionic 4 Cordova Windows 10 app back button?

查看:84
本文介绍了如何隐藏/删除Ionic 4 Cordova Windows 10应用程序后退按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我以前曾使用以下命令来删除Windows bac卡罗(如建议

I previously use to use the following to remove the Windows bac karrow (as suggested here

    private hideWindowsTitleBackArrow(): void {
        try {
          let w: any = window;
          if (w.cordova != undefined && w.cordova.platformId == "windows") {
            let currentView = w.Windows.UI.Core.SystemNavigationManager.getForCurrentView();
            currentView.appViewBackButtonVisibility = w.Windows.UI.Core.AppViewBackButtonVisibility.collapsed;
          }
        } catch (error) {
          this.logger.error(`Error in hideWindowsTitleBackArrow: ${error}`);
        }
      }

在Ionic 4更新后立即运行此命令时,现在会收到以下警告.

When I run this now after my Ionic 4 update, now get the following warning..

The method Windows.UI.ApplicationSettings.SettingsPane.getForCurrentView has been deprecated. SettingsPane is deprecated and might not work on all platforms. For more info, see MSDN.

它不再起作用...

有人对更新的方式有任何建议吗?

Does anyone have any suggestions on perhaps an updated way of doing this?

在此先感谢您的帮助!

推荐答案

上面的代码似乎仍然有效,但是,我现在需要稍后再调用它.

It seems the code above still works, however, I now need to call it a bit later.

以前,我会在platform.ready()

 private async initializeApp() : Promise<void> {
   try {              
    await this.platform.ready();                      
    this.statusBar.styleDefault();      
    this.hideWindowsTitleBackArrow();

要使其正常工作,我现在将通话设置为计时器...

To get it to work I now put the call in a timer...

setTimeout(() => this.hideWindowsTitleBackArrow(), 100);

这篇关于如何隐藏/删除Ionic 4 Cordova Windows 10应用程序后退按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆