-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[Issue-Resolver] Fix TitleView image not showing on iOS 26 and macOS 26.1 #32913
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
base: main
Are you sure you want to change the base?
Conversation
Fixes dotnet#32899 The regression was introduced in PR dotnet#32341 where the Height property was set on the TitleViewContainer for iOS 26+. This interfered with the UIContainerView's layout logic, preventing images from rendering properly in Shell.TitleView. The fix removes the Height property assignment while keeping the Frame setting, which is sufficient for proper sizing with autoresizing masks. Changes: - Removed Height property assignment in TitleViewContainer constructor - Added UI test case Issue32899 to verify TitleView images display correctly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a regression where images in Shell.TitleView fail to display on iOS 26 and macOS 26.1. The issue was introduced in PR #32341, which set the Height property on TitleViewContainer in addition to setting its Frame. The fix removes this redundant Height assignment, allowing images to render correctly while preserving the original iOS 26 layout fix.
Key Changes:
- Removes a single line setting
Heightproperty in theTitleViewContainerconstructor for iOS 26+ - Adds comprehensive UI test coverage with XAML page and NUnit test to prevent future regressions
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellPageRendererTracker.cs |
Removes the problematic Height property assignment that prevented images from displaying in TitleView on iOS 26+ |
src/Controls/tests/TestCases.HostApp/Issues/Issue32899.xaml |
Creates test page with ImageButton in Shell.TitleView to reproduce the issue |
src/Controls/tests/TestCases.HostApp/Issues/Issue32899.xaml.cs |
Code-behind with Issue attribute marking the test for iOS and macOS platforms |
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue32899.cs |
NUnit test that verifies TitleView image is present and uses screenshot validation |
| @@ -0,0 +1,10 @@ | |||
| namespace Maui.Controls.Sample.Issues; | |||
Copilot
AI
Nov 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The code-behind file is missing the using directives present in the reference test Issue18946. While this file compiles and runs, it's inconsistent with the established pattern in the codebase.
Consider adding the standard using directives for consistency:
using Microsoft.Maui.Controls;
using Microsoft.Maui.Controls.Xaml;Additionally, the [XamlCompilation(XamlCompilationOptions.Compile)] attribute is present in Issue18946 but missing here. While optional, it's a best practice that ensures XAML is compiled rather than parsed at runtime, improving performance.
|
@kubaflo should MatchHeight also be set to false? Why exactly does setting the height break it? This feels like maybe there's a problem with the match height logic? |
|
/azp run MAUI-UITests-public |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
Is match height correct behavior on title view for ios? I forget how the rules are here. Like if the user specifies a height of 20 on the top level view Do we still arrange at the height of the title view container? Should the titleview be switched to that other general container we use to host ios views? |
|
@PureWeen the issue isn’t actually with The actual issue occurs when navigating from Shell to a subpage. In that scenario: So the layout logic depending on the navigation bar frame doesn’t run at all. |
|
Sounds good! So, the behavior of MatchHeight is correct and consistent with other platforms? I was wonder if switching it over to that general container view structure would make this more consistent overall |
Introduces UpdateTitleViewInternal in ShellPageRendererTracker and calls it from ShellSectionRenderer for iOS 26+ and Mac Catalyst 26+. This ensures TitleView is updated correctly when the ViewController is added to a NavigationController, addressing layout issues on newer OS versions.


Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Description of Change
Fixes #32899 - TitleView images now display correctly on iOS 26 and macOS 26.1.
Root Cause
The regression was introduced in PR #32341 (commit
971e326), which attempted to fix TitleView layout issues on iOS 26+ by switching from Auto Layout constraints to autoresizing masks.In that PR, line 739 of
ShellPageRendererTracker.csset theHeightproperty on theTitleViewContainer:This line caused a critical issue with the
UIContainerView's layout logic. WhenHeightis set andMatchHeightistrue, theLayoutSubviewsmethod measures and arranges the child view using that fixed height (see lines 119-135 ofUIContainerView.cs). This prevented images inside the TitleView from rendering properly because the view measurement and arrangement logic was constrained by the full navigation bar height, interfering with the image layout.Solution
Remove the
Heightproperty assignment while keeping theFramesetting. The Frame already correctly sizes the container:Before (causing the bug):
After (fixed):
The
Frameproperty is sufficient for proper sizing when using autoresizing masks on iOS 26+. Setting theHeightproperty is unnecessary and breaks the image rendering.Why This Works
AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth(set in the base constructor) handles size adjustmentsHeightforces the UIContainerView'sLayoutSubviewsto use the fixed height for measurement, which breaks the image layout logicImpact
Test Coverage
Added comprehensive UI test case Issue32899:
Test Files:
src/Controls/tests/TestCases.HostApp/Issues/Issue32899.xaml- ContentPage with ImageButton in Shell.TitleViewsrc/Controls/tests/TestCases.HostApp/Issues/Issue32899.xaml.cs- Issue attribute and initializationsrc/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue32899.cs- NUnit test that verifies:The test reproduces the exact scenario from the manual test case (G8 - ShellTitleView command binding):
dotnet_bot.pngsourceComparison with Other Solutions
I developed this solution independently by:
UIContainerViewlayout logic to understand howHeightaffects renderingHeightNo other PRs addressing issue #32899 were found at the time of implementation.
The fix is minimal and surgical:
Issues Fixed
Fixes #32899
Regression Information
Platforms Affected
Platforms Tested
Screenshots
Before (iOS 26 & macOS 26.1)
Dotnet bot image is missing from the title bar.
After (iOS 26 & macOS 26.1)
Dotnet bot image is visible in the title bar.
(Expected behavior matches the screenshots from issue #32899 showing the working state on iOS 18.5 and macOS 15.6)