Skip to content

Commit d6bbe9d

Browse files
authored
[iOS] Fix added for Navigation.SetTitleView does not work in ios 26. (#31831)
* [iOS] Fix added for Navigation.SetTitleView does not work in ios 26. * changes added. * changed the version condition.
1 parent 10b65f8 commit d6bbe9d

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/Controls/src/Core/Compatibility/Handlers/NavigationPage/iOS/NavigationRenderer.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1918,7 +1918,13 @@ class Container : UIView
19181918

19191919
public Container(View view, UINavigationBar bar) : base(bar.Bounds)
19201920
{
1921-
if (OperatingSystem.IsIOSVersionAtLeast(11) || OperatingSystem.IsMacCatalystVersionAtLeast(11))
1921+
// For iOS 26+, we need to use autoresizing masks instead of constraints to ensure proper TitleView display
1922+
if (OperatingSystem.IsIOSVersionAtLeast(26) || OperatingSystem.IsMacCatalystVersionAtLeast(26))
1923+
{
1924+
TranslatesAutoresizingMaskIntoConstraints = true;
1925+
AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
1926+
}
1927+
else if (OperatingSystem.IsIOSVersionAtLeast(11) || OperatingSystem.IsMacCatalystVersionAtLeast(11))
19221928
{
19231929
TranslatesAutoresizingMaskIntoConstraints = false;
19241930
}
@@ -2007,7 +2013,9 @@ public override CGRect Frame
20072013
{
20082014
if (Superview != null)
20092015
{
2010-
if (!(OperatingSystem.IsIOSVersionAtLeast(11) || OperatingSystem.IsMacCatalystVersionAtLeast(11)))
2016+
// For iOS 26+ and pre-iOS 11, we use autoresizing masks and need to adjust the frame manually
2017+
if (OperatingSystem.IsIOSVersionAtLeast(26) || OperatingSystem.IsMacCatalystVersionAtLeast(26) ||
2018+
!(OperatingSystem.IsIOSVersionAtLeast(11) || OperatingSystem.IsMacCatalystVersionAtLeast(11)))
20112019
{
20122020
value.Y = Superview.Bounds.Y;
20132021

0 commit comments

Comments
 (0)