Я хочу скрыть текст кнопки «Назад» в Xamarin на iOS, я пробовал:
<Style TargetType="NavigationPage">
<Setter Property="BackButtonTitle" Value="" />
</Style>
и этот код:
<Style TargetType="ContentPage">
<Setter Property="NavigationPage.BackButtonTitle" Value="" />
</Style>
Но текст все еще появляется
РЕШИТЬ:
Средство визуализации iOS:
[assembly: ExportRenderer(typeof(ContentPage), typeof(BackButtonPag))]
[assembly: ExportRenderer(typeof(NavigationPage), typeof(BackButtonNav))]
public class BackButtonPag : PageRenderer
{
public override void ViewWillAppear(bool animated)
{
base.ViewWillAppear(animated);
if (NavigationController != null)
NavigationController.TopViewController.NavigationItem.BackBarButtonItem = new UIBarButtonItem("", UIBarButtonItemStyle.Plain, null);
}
}
public class BackButtonNav : NavigationRenderer
{
public override void ViewWillAppear(bool animated)
{
base.ViewWillAppear(animated);
NavigationBar.TopItem.BackBarButtonItem = new UIBarButtonItem("", UIBarButtonItemStyle.Plain, null);
}
}
Также добавьте это
NavigationPage.BackButtonTitle = ""
в Main.xaml вашей MasterDetailPage