Android 和 Iphone 之间的不同行为与模板弹出 Xamarin.Forms 应用程序

Different behaviour between Android and Iphone with template flyout Xamarin.Forms app

使用模板“flyout”创建新的 Xamarin.Forms 应用程序时,我在 Android 模拟器 Android Simulator but the same code when deployed on my Iphone Simulator doesn't show the tab bar and the flyout. They still are there, meaning that if I press the screen where the tabs and the flyout should be, I get the expected behavoiur, but the screen doesn't show these items Iphone Simulator 上得到了预期的行为。我正在使用 Visual Studio 2019,Android 模拟器是“Pixel 2 Pie 9.0 - API 28 (Android 9.0 - API 28)”,而 Iphone 模拟器是“Iphone 11 iOS 15.2”

对于iOS是因为你的Tabbar没有颜色

您可以在 itemsApp->AppDelegate.cs->FinishedLaunching 方法上添加:

if (UIDevice.CurrentDevice.CheckSystemVersion(13, 0))
{
    UITabBar.Appearance.TintColor = UIColor.Blue;
    UITabBar.Appearance.BackgroundColor = UIColor.Blue;
    UINavigationBar.Appearance.BackgroundColor = UIColor.Blue;
}

FinishedLaunching 的完整方法是:

 public override bool FinishedLaunching(UIApplication app, NSDictionary options)
    {
        global::Xamarin.Forms.Forms.SetFlags("CollectionView_Experimental");
        global::Xamarin.Forms.Forms.Init();
        LoadApplication(new App());

        if (UIDevice.CurrentDevice.CheckSystemVersion(13, 0))
        {
            UITabBar.Appearance.TintColor = UIColor.Blue;
            UITabBar.Appearance.BackgroundColor = UIColor.Blue;
            UINavigationBar.Appearance.BackgroundColor = UIColor.Blue;
        }

        return base.FinishedLaunching(app, options);
    }