删除 Xamarin.Forms 中的导航栏阴影/线条



如何在 Xamarin.Forms 中删除导航栏阴影和内容行页面。 是否可以在不渲染的情况下执行此操作。

仅适用于 Xamarin Forms,iOS。将此添加到您的应用程序代表

UINavigationBar.Appearance.ShadowImage = new UIImage(); //No line under the navigation

在 xamarin iOS 项目中添加此渲染类

[assembly: ExportRenderer(typeof(NavigationPage), typeof(CustomNavigationRenderer))]
namespace YOUR_IOS_NAMESPACE
{
public class CustomNavigationRenderer : NavigationRenderer
{
public override void ViewDidLoad()
{
base.ViewDidLoad();
NavigationBar.ShadowImage = new UIImage(); 
}
}
}

最新更新