0

I am adding iOS support for my already existing Xamarin Forms android app.

The toolbar items, navigational back arrow and the hamburger menu do not show on iOS:

enter image description here

While they work perfectly on Android: enter image description here

The Application.MainPage is set to a Shell:

<Shell xmlns="http://xamarin.com/schemas/2014/forms"
        xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
        x:Class="app.MainPage"
       FlyoutBackgroundColor="{StaticResource cBackgroundColorDark}"
       Shell.TabBarTitleColor="{StaticResource cBackgroundColor}"
       Shell.BackgroundColor="{StaticResource cBackgroundColor}">

    <Shell.Resources>
        <ResourceDictionary>
            <vm:FlyoutVM x:Key="vm" x:Name="vm"/>
        </ResourceDictionary>
    </Shell.Resources>

    <Shell.FlyoutHeader>
    </Shell.FlyoutHeader>

    <ShellContent Title="page1"
                  IsTabStop="True"
                  ContentTemplate="{DataTemplate views:Page1Page}"/>
    ...

    <Shell.FlyoutContent>
    </Shell.FlyoutContent>
    
    <Shell.FlyoutFooter>
    </Shell.FlyoutFooter>

</Shell>

The page with the toolbar items is simply:

<ContentPage>
    <ContentPage.ToolbarItems>

        <ToolbarItem Text="Example"
                     IconImageSource="Example.png"
                     Clicked="ExampleToolbarItem_Clicked"
                     />
      
    </ContentPage.ToolbarItems>
</ContentPage>

All navigation (hamburger menu, back button ect) and toolbar items can be tapped on iOS and work as intended - they just are not visible.

I do not understand why this does not work on iOS, any suggestions why this might be the case?

(I cannot find any styling that might be making it act differently. I have also tried displaying a toolbar with just text (no icons) and the problem persists)

I can provide more code if needed.

EDIT

I ended up creating a new Xamarin shell template project and moving everything over. That fixed the issue...

Bouapha
  • 31
  • 3
  • Where are those images stored? If they are resources, have you made sure the iOS resources have Properties/Build Action = BundleResource? – ToolmakerSteve May 17 '22 at 20:29
  • Also, verify that they aren't defaulting to the same color as the bar background. – ToolmakerSteve May 17 '22 at 21:26
  • Thanks for the suggestions but alas no fix. The images are BundledResources and I am able to load images that are not on the tabbar. I can narrow down the bar background colour to Shell.BackgroundColor="{StaticResource cBackgroundColor}", but I don't see this StaticResource referenced anywhere that would effect the images. – Bouapha May 18 '22 at 08:54
  • width, height of those pngs, in pixels? They should scale automatically, but if the dimensions are too large, maybe there is some xamarin bug. OR maybe a problem with png format. Are they "indexed" format? Try saving as full color pngs. – ToolmakerSteve May 18 '22 at 16:07

1 Answers1

0

Most likely the image size for ios is incorrect. I use this https://appicon.co/#image-sets to create image set for ios.