Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Mac] TitleBar not always initally set #27487

Merged
merged 1 commit into from
Feb 4, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions src/Core/src/Platform/iOS/WindowViewController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ void UpdateContentWrapperContentFrame()
_contentWrapperView.Subviews[0].Frame = frame;
}
}

/// <summary>
/// Sets up the TitleBar in the ViewController.
/// </summary>
Expand All @@ -108,8 +108,9 @@ public void SetUpTitleBar(IWindow window, IMauiContext mauiContext)
return;
}

var newTitleBar = window.TitleBar?.ToPlatform(mauiContext);
HasCustomTitleBar = newTitleBar is not null;
var newTitleBar = window.TitleBar;
var newPlatTitleBar = newTitleBar?.ToPlatform(mauiContext);
HasCustomTitleBar = newPlatTitleBar is not null;

IView? iTitleBar = null;
_iTitleBarRef?.TryGetTarget(out iTitleBar);
Expand All @@ -120,13 +121,13 @@ public void SetUpTitleBar(IWindow window, IMauiContext mauiContext)
iTitleBar?.DisconnectHandlers();
iTitleBar = null;

if (newTitleBar is not null)
if (newPlatTitleBar is not null)
{
iTitleBar = window.TitleBar;
View.AddSubview(newTitleBar);
iTitleBar = newTitleBar;
View.AddSubview(newPlatTitleBar);
}

_titleBar = newTitleBar;
_titleBar = newPlatTitleBar;
_iTitleBarRef = new WeakReference<IView?>(iTitleBar);
}

Expand Down
Loading