Xamarin Forms:如何隐藏后退按钮标题? [英] Xamarin Forms: how to hide back button title?

查看:209
本文介绍了Xamarin Forms:如何隐藏后退按钮标题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Xamarin Forms iOS应用程序中,所有页面中也都显示了先前的页面名称,并带有后退"按钮.有什么方法可以隐藏上一页的标题吗?

In my Xamarin Forms iOS application the previous page name is also appearing with the back button in all pages. Is there any way to hide the title of the previous page?

推荐答案

如果使用导航页,则可以将空字符串用作后退"按钮标题:

If you use Navigation Page, you can use an empty string for the Back button title:

NavigationPage.SetBackButtonTitle(this, ""); //Empty string as title

据我所知,它将影响导航堆栈的下一页("this"之后的页面将具有空的"Back"(返回)按钮标题).不要在这上面引用我.

As far as I remember, it will affect the next page on the navigation stack (the page after 'this' will have an empty Back button title). Don't quote me on this.

您可以使用以下方法完全隐藏后退"按钮:

You can completely hide the Back button with:

NavigationPage.SetHasBackButton(this, false);

另一种选择是通过将Navigation.PushAsync(yourPage)替换为Navigation.PushModalAsync(yourPage)来使用模式页面,这将以模态显示该页面.

Another option is to use a Modal page by replacing Navigation.PushAsync(yourPage) with Navigation.PushModalAsync(yourPage) which will present the page modally.

仅供参考,后退"按钮将自动填充上一页的标题"属性(如果未设置标题",则默认为后退".

FYI, the back button is automatically populated with the Title property of the previous page (or it will default to Back if the Title was not set).

这篇关于Xamarin Forms:如何隐藏后退按钮标题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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