1

When I upgrade my iOS application to the Xamarin Forms 5.0.0.2125 to 5.0.0.2196 I have a border under the header of my application.

Old: enter image description here

New: enter image description here

It is on pages with and without custom title. So I presume that this is a global setting. Is there a way to override that again?

Edit:

I tried the followings, unfortunately without success:

Adding the following lines in the FinishedLaunching in the AppDelegate:

        UINavigationBar.Appearance.SetBackgroundImage(new UIImage(), UIBarMetrics.Default);
        UINavigationBar.Appearance.ShadowImage = new UIImage();

Or add this, which should work from iOS 13 upwards:

       UINavigationBar.Appearance.StandardAppearance = null;

Or since I read that there is a bug in iOS 15 this version:

            var appearance = new UINavigationBarAppearance()
            {
                BackgroundColor = UIColor.Clear, ShadowColor = null,
            };

            UINavigationBar.Appearance.StandardAppearance = appearance;
            UINavigationBar.Appearance.ScrollEdgeAppearance = appearance;
            UINavigationBar.Appearance.CompactAppearance = appearance;

Unfortunately all those where without success.

Edit: GitHub Link https://github.com/MoneyFox/MoneyFox

NPadrutt
  • 3,619
  • 5
  • 24
  • 60
  • I test both on 5.0.0.2125 and 5.0.0.2196 ,it's the same result , there is border(line) under the toolbar , which version of simulator did you test on , and could you try this on a real device to see if problem persists. – ColeX Nov 12 '21 at 09:57
  • Actually I noticed it first on my real device (Iphone 12 with iOS 15). But I also have it on a Simulator of the latest xCode with MacOs Monterey. – NPadrutt Nov 12 '21 at 10:17
  • Or the other question if you say that there is usually a borderline on the toolbar: is there a way I can remove that border? – NPadrutt Nov 12 '21 at 12:28

1 Answers1

0

Try to override BackgroundImage and shadowImage on UINavigationBar in AppDelegate .

Try the following code , it works on my side .

public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate  
    {
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            Rg.Plugins.Popup.Popup.Init();
            global::Xamarin.Forms.Forms.Init();
            LoadApplication(new App());

            //add thie line
            UINavigationBar.Appearance.SetBackgroundImage(new UIImage(), UIBarMetrics.Default);
            UINavigationBar.Appearance.ShadowImage = new UIImage();

            return base.FinishedLaunching(app, options);
        }
    } 

Refer to How to hide UINavigationBar 1px bottom line.

ColeX
  • 14,062
  • 5
  • 43
  • 240
  • sorry my late response! I tried your code as well as other options under your link. But so far it didn't work unfortunately. I updated my original post with more information what I tried. Maybe I missed something. – NPadrutt Nov 23 '21 at 21:57
  • Since the code is working on my side, I need more information to reproduce your problem . Are you developing `Shell` or `None-Shell` project ? Are you using a `FlyoutPage`? If so could you provide the code in shared project ? – ColeX Nov 24 '21 at 07:47
  • I'm using Shell. The project is actually open source. I linked the github repo. – NPadrutt Nov 24 '21 at 10:08
  • This is a potential issue in Shell project , I tried to create custom renderer and tried all the ways online but no luck , the navigation bar must be redrawn somewhere it is a black box , consider raise this issue on :https://github.com/xamarin/Xamarin.Forms/issues. – ColeX Nov 25 '21 at 03:09
  • The issue is opened here: https://github.com/xamarin/Xamarin.Forms/issues/14938 – NPadrutt Dec 02 '21 at 07:26