NavigationBar.ShadowImage =新的UIImage()在xamarin.forms 4.5之后的IOS上不删除阴影线。新的方法是什么?
我尝试了所有这些方法,但都不起作用。
protected override void OnElementChanged(VisualElementChangedEventArgs e)
{
base.OnElementChanged(e);
NavigationBar.SetBackgroundImage(new UIImage(), UIBarMetrics.Default);
NavigationBar.ShadowImage = new UIImage();
UINavigationBar.Appearance.SetBackgroundImage(new UIImage(), UIBarMetrics.Default);
UINavigationBar.Appearance.ShadowImage = new UIImage();
}
public override void ViewDidLoad()
{
base.ViewDidLoad();
UINavigationBar.Appearance.SetBackgroundImage(new UIImage(), UIBarMetrics.Default);
UINavigationBar.Appearance.ShadowImage = new UIImage();
NavigationBar.SetBackgroundImage(new UIImage(), UIBarMetrics.Default);
NavigationBar.ShadowImage = new UIImage();
}发布于 2020-04-15 20:05:26
我这样解决了我的问题:
我的自定义导航页面
public CustomNavigationPage(Xamarin.Forms.Page root) : base(root)
{
InitializeComponent();
On<iOS>().SetHideNavigationBarSeparator(true);
}和导航页面渲染器
public override void ViewWillAppear(bool animated)
{
base.ViewWillAppear(animated);
if (Element is Xamarin.Forms.NavigationPage navigationPage)
{
if (navigationPage.OnThisPlatform().HideNavigationBarSeparator())
{
if (UIDevice.CurrentDevice.CheckSystemVersion(13, 0))
{
NavigationBar.StandardAppearance.ShadowColor = null;
}
}
}
}https://stackoverflow.com/questions/61218265
复制相似问题