我需要有关Xamarin Forms iOS的帮助(Android运行良好)。当我在选项卡式项目上打开一个新页面时,iOS上的导航栏看不见,但当上下滚动页面时,导航栏出现了,虽然看不见,但后退按钮就在那里,可以点击。项目的所有其他页面都有相同的行为,后退按钮在那里,但看不见。请参见下图。 如何将导航栏设置为所有页面都可见?
查看GIF此处:
这是IOS15的默认行为更改,要解决这个问题,我们只需要修改UINavigationBarAppearance
的scrollEdgeAppearance
属性。
将以下代码放在iOS项目的AppDelegate.cs
或SceneDelegate.cs
中。
UINavigationBarAppearance a = new UINavigationBarAppearance();
a.ConfigureWithTransparentBackground();
a.BackgroundColor = UIColor.Blue;
a.TitleTextAttributes = new UIStringAttributes() { ForegroundColor = UIColor.White};
UINavigationBar.Appearance.StandardAppearance = a;
UINavigationBar.Appearance.CompactAppearance = a;
UINavigationBar.Appearance.ScrollEdgeAppearance = a;
请参阅
https://developer.apple.com/forums/thread/684454。