Window's title bar separator draws way out of place on Mac Catalyst, not even close to title bar location

So I built my app with Mac Catalyst. I see this little line appear and disappear periodically in the window. Then all of a sudden it disappears when the window's activation state changes sometimes. It looks like a weird little glitch.

Turns out this is the title bar's separator which is UITitlebarSeparatorStyleAutomatic (I believe the system hides/shows the separator in this mode based on current window states. I change the separator style to shadow and sure enough it draws like a shadow and never disappears. It's not even close to where the separator is supposed to be (nowhere near the title bar).

The only workaround I have is to use UITitlebarSeparatorStyleNone which I'll do if I have to but was wondering if someone else has run into this and has a better workaround.

I think if figured out what's going on. On launch my app needs to determine whether or not it should show onboarding UI based on a few conditions. While my app is making this determination, I overlay a separate UIWindow in the UIWindowScene that shows a UIActivityIndicatorView. Then if I do in fact have to show the onboarding UI, this overlayed window shows the onboarding view controller by presenting it modally.

Underneath this overlayed window is my standard UIWindow. In that window hierarchy underneath there is a UINavigationController with navigation bar. It appears UIKit on macOS draws this separator line underneath the navigation bar when the window is in certain states...but the separator is bleeding through from the UIWindow that's offscreen. That UIWindow should be completely offscreen while the overlay window is the key window (and it is, except for the line separator bleeding through and causing this glitch).

So if I do this:

#if TARGET_OS_MACCATALYST

    [self setNavigationBarHidden:YES animated:NO];

    #endif

The line separator issue goes away.

The separator snaps into place after I resize the window....anyway I can programmatically force the window to relayout the separator? The request geometry update method isn't released yet (I guess it will be released when iPadOS 16 comes out?)

This sounds like a potential bug. Could you file a feedback with a small sample project that exhibits this issue?

Accepted Answer

I think if figured out what's going on. On launch my app needs to determine whether or not it should show onboarding UI based on a few conditions. While my app is making this determination, I overlay a separate UIWindow in the UIWindowScene that shows a UIActivityIndicatorView. Then if I do in fact have to show the onboarding UI, this overlayed window shows the onboarding view controller by presenting it modally.

Underneath this overlayed window is my standard UIWindow. In that window hierarchy underneath there is a UINavigationController with navigation bar. It appears UIKit on macOS draws this separator line underneath the navigation bar when the window is in certain states...but the separator is bleeding through from the UIWindow that's offscreen. That UIWindow should be completely offscreen while the overlay window is the key window (and it is, except for the line separator bleeding through and causing this glitch).

So if I do this:

#if TARGET_OS_MACCATALYST

    [self setNavigationBarHidden:YES animated:NO];

    #endif

The line separator issue goes away.

I did open a feedback on this: FB11681351 duplicating the information I provided in this thread.

Window's title bar separator draws way out of place on Mac Catalyst, not even close to title bar location
 
 
Q