I’ve a .NET MAUI App with out Shell.
it often has the tabbar hooked up to the underside of the web page.
Since iOS 18 the tabbar will not be hooked up to the underside anymore and altered to a floating tabbar on the high of the web page.
I already discovered entries on methods to repair that when the MAUI App does use shell right here. However in my case the App does not use shell.
The code of the tabbed web page I’m utilizing:
BaseAppTabbedPage.xaml
BaseAppTabbedPage.xaml.cs
utilizing MyApp.Utility.Companies.Navigation;
utilizing MyApp.Utility.Views;
namespace MyApp.Utility.CustomControls;
public partial class BaseAppTabbedPage : TabbedPage
{
public BaseAppTabbedPage(INavigationService navigationService)
{
InitializeComponent();
navigationService.PushAsync(DashboardTab.Navigation);
navigationService.PushAsync(FavoriteTab.Navigation);
navigationService.PushAsync(WatchlistTab.Navigation);
navigationService.PushAsync(MoreTab.Navigation);
}
}
I do know it will need to have one thing to do with setting the TraitOverrides.HorizontalSizeClass
to UIUserInterfaceSizeClass.Unspecified
however the approaches I did had no impact.
I attempted so as to add a CustomTabbedPageHandler
that inherits TabbedViewHandler
and add it to the ConfigureMauiHandlers
in my MauiProgram.cs
however this appears to not have any impact.
So the issue stays the identical
CustomTabbedPageHandler.cs
utilizing Microsoft.Maui.Handlers;
utilizing UIKit;
namespace MyApp.Utility.iOS.PlatformSpecificHandlers;
public class CustomTabbedPageHandler : TabbedViewHandler
{
protected override void ConnectHandler(UIView platformView)
{
base.ConnectHandler(platformView);
if (platformView is UITabBar tabBar)
{
tabBar.TraitOverrides.HorizontalSizeClass = UIUserInterfaceSizeClass.Unspecified;
}
}
}
MyApp.Utility.iOS/MauiProgram.cs
utilizing MyApp.Utility.CustomControls;
utilizing Microsoft.Maui.Controls.Handlers.Compatibility;
utilizing MyApp.Utility.CustomControls;
utilizing MyApp.Utility.iOS.PlatformSpecificHandlers;
utilizing MyApp.Utility.Companies;
namespace MyApp.Utility.iOS;
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder.ConfigureMauiHandlers(handlers =>
{
handlers.AddHandler(typeof(TabbedPage), typeof(CustomTabbedPageHandler));
});
builder
.UseSharedMauiApp();
var app = builder.Construct();
ServiceHelper.ServiceProvider = app.Companies;
return app;
}
}