Hamburger icon not showing on iOS developed by Prism for Xamarin.Forms

故事扮演 提交于 2020-03-05 04:00:13

问题


Below is my XAML page for my MasterDetailPage:

<MasterDetailPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:d="http://xamarin.com/schemas/2014/forms/design"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:b="clr-namespace:Prism.Behaviors;assembly=Prism.Forms"
             mc:Ignorable="d"
             x:Class="JapaneseLearnPrism.Views.MenuPage">
    <MasterDetailPage.Master>
        <NavigationPage Title="Menu" Icon="ic_hamburger.png">
            <x:Arguments>
                <ContentPage Title="{Binding Title}">
                    <!--Content for my menus here.-->
                </ContentPage>
            </x:Arguments>
        </NavigationPage>
    </MasterDetailPage.Master>
</MasterDetailPage>

And this is how I set up the Page Path for Prism:

protected override async void OnInitialized()
{
    InitializeComponent();
            Xamarin.Forms.PlatformConfiguration.AndroidSpecific.Application.SetWindowSoftInputModeAdjust(this, Xamarin.Forms.PlatformConfiguration.AndroidSpecific.WindowSoftInputModeAdjust.Resize);

    // await NavigationService.NavigateAsync("NavigationPage/MainPage");
    await NavigationService.NavigateAsync(nameof(MenuPage) + "/" + nameof(NavigationPage) + "/" + nameof(Views.MainPage));
}

This is works fine for the MD page function. And the hamburger icon is correctly showing in Android but not iOS. I am wondering why. I searched online everyone but actually nothing solved. Hope be able to get the answer here.

Thanks.


回答1:


Use IconImageSource inside MasterDetailPage to display HamburgerIcon as far as Android is concern it uses it's default hamburger Icon that's why it is showing in Android and not in iOS.

<MasterDetailPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:d="http://xamarin.com/schemas/2014/forms/design"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:b="clr-namespace:Prism.Behaviors;assembly=Prism.Forms"
             mc:Ignorable="d"
             IconImageSource="ic_hamburger.png"
             x:Class="JapaneseLearnPrism.Views.MenuPage">



来源:https://stackoverflow.com/questions/60228891/hamburger-icon-not-showing-on-ios-developed-by-prism-for-xamarin-forms

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!