dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22k stars 1.72k forks source link

Wrong underline under TitleView on iOS #6735

Open AlexeyZhukoff opened 2 years ago

AlexeyZhukoff commented 2 years ago

Description

Shell has underline under TitleView if BackGroundColor is setted

Steps to Reproduce

  1. Download example Archive.zip
  2. Run application Archive.zip

Version with bug

Release Candidate 2 (current)

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

iOS 15.4

Did you find any workaround?

no

Relevant log output

No response

Redth commented 2 years ago

This might be expected behaviour... If you set VerticalTextAlignment="Center" on the label it shows centered as in the screenshot below...

@PureWeen thoughts?

Screen Shot 2022-05-02 at 9 54 18 AM
PureWeen commented 2 years ago

@Redth so this isn't really a bug. It's just kind of a confusion based on the styling defaults. The TitleView gets placed inside the UINavigationBar on iOS and our default styles make it the same color as the background. So the underline you are seeing there is the shadow from the NavBar. You might be able to get rid of it by setting Shell.NavBarHasShadow to false?

AlexeyZhukoff commented 2 years ago

Yes, i try this, but horizontal line still visible

AntonKosenkoDX commented 2 years ago

@samhouts Hello! Any update on this issue?

ghost commented 2 years ago

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

KieranMaclagan commented 1 year ago

Still seeing this after the .NET 7 release. Confirmed setting Shell.NavBarHasShadow to false doesn't fix it.

FM1973 commented 1 year ago

This is still an issue

FM1973 commented 1 year ago

As a workaround: https://github.com/xamarin/Xamarin.Forms/issues/14938

Zhanglirong-Winnie commented 1 year ago

Verified this issue with Visual Studio Enterprise 17.6.0 Preview 2.0. Repro on iOS simulator with sample project. Archive.zip image

Zack-G-I-T commented 9 months ago

Is anyone looking into this or have a workaround at least? The separator is so ugly when trying to be an immersive app

acaliaro commented 7 months ago

Any news for this?

ramonB1996 commented 7 months ago

Possible workaround, this works for navigationbar itself, so hopefully also for TitleView.

public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
    {
        // Remove 1px shadow beneath navigationbar
        UINavigationBar.Appearance.ShadowImage = new UIImage();

        return base.FinishedLaunching(application, launchOptions);
    }
Zack-G-I-T commented 6 months ago

As a workaround for this, I copied the ShellNavBarAppearanceTracker class into a new custom one "CustomNavBarAppearanceTracker", and just added this code under both methods UpdateNavigationBarAppearance and UpdateiOS13NavigationBarAppearance:

navBar.ShadowImage = new UIImage();

Then created a new ShellRenderer under ios platform

    public class CustomShellRenderer : ShellRenderer
    {
        protected override IShellNavBarAppearanceTracker CreateNavBarAppearanceTracker()
        {
            return new CustomNavBarAppearanceTracker();
        }
    }

Then in maui program under AddHandlers - I added

#if IOS
            handlers.AddHandler(typeof(Shell), typeof(MyApp.Platforms.iOS.Renderers.CustomShellRenderer));
#endif