Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xamarin Forms ios displaying "default" instead of Hamburger Icon

Hi there I'm creating a Xamarin Forms application with Prism and everything is running smoothly bar one small UI issue. The ios version is displaying the following :

enter image description here

The Hamburger menu is not showing and in its place is a piece of text labeled "default".The issue is only occurring in the ios version. I researched the issue and some mentioned that you must wrap it in a navigation page. However on my app startup I wrap the page in a navigation page using the prism navigation service:

protected override void OnInitialized()
{
    InitializeComponent();
    NavigationService.navigateAsync("WelcomePage/NavPage/TBHomePage");
}

If anyone has experienced this before it would be a create help Thanks for reading :)

like image 434
JH_Dev Avatar asked Jan 05 '23 10:01

JH_Dev


1 Answers

iOS doesn't have a hamburger icon in its system icons. You will have to manually add it. Here's a github project where I added a menu icon to a Xamarin.Forms project.

https://github.com/valdetero/SevenDays/blob/master/SevenDays.UI/SevenDays.UI/Views/MenuPage.cs#L17

public class MenuPage : ContentPage
{
    public MenuPage()
    {
        Icon = PlatformImage.Resolver("menu.png");
        Title = "menu"; // The Title property must be set.

Then make sure you have the required resolutions (1x, @2x, @3x) in your Resources folder.

https://github.com/valdetero/SevenDays/tree/master/SevenDays.UI/SevenDays.UI.iOS/Resources

PlatformImage.Resolver only had formatted the path per platform:

public static string Resolver(string image)
{
    return string.Format(Device.OnPlatform("{0}", "{0}", "Assets/{0}"), image);
}
like image 52
valdetero Avatar answered Jan 30 '23 18:01

valdetero