I want to hide text of back button in Xamarin on iOS, I've tried:
<Style TargetType="NavigationPage">
<Setter Property="BackButtonTitle" Value="" />
</Style>
and this code:
<Style TargetType="ContentPage">
<Setter Property="NavigationPage.BackButtonTitle" Value="" />
</Style>
But text still appears
SOLVED:
iOS renderer:
[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);
}
}
Also add this
NavigationPage.BackButtonTitle = ""
to Main.xaml of your MasterDetailPage