Skip to content

Commit 3dab93a

Browse files
addressed AI review summary and added pending snaps
1 parent 7c1aeea commit 3dab93a

9 files changed

Lines changed: 20 additions & 3 deletions

File tree

src/Controls/tests/TestCases.HostApp/Issues/Issue13258.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
namespace Maui.Controls.Sample.Issues;
22

3-
[Issue(IssueTracker.Github, 13258, "MAUI Slider thumb image is big on android", PlatformAffected.iOS | PlatformAffected.macOS)]
3+
[Issue(IssueTracker.Github, 13258, "MAUI Slider thumb image is big on ios/ Mac", PlatformAffected.iOS | PlatformAffected.macOS, issueTestNumber: 2)]
44
public class Issue13258 : TestContentPage
55
{
66
protected override void Init()
30 Bytes
Loading
-412 Bytes
Loading
-503 Bytes
Loading
-503 Bytes
Loading
-412 Bytes
Loading

src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue13258.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public Issue13258(TestDevice testDevice) : base(testDevice)
1111
{
1212
}
1313

14-
public override string Issue => "MAUI Slider thumb image is big on android";
14+
public override string Issue => "MAUI Slider thumb image is big on ios/ Mac";
1515

1616
[Test]
1717
[Category(UITestCategories.Slider)]
56.3 KB
Loading

src/Core/src/Platform/iOS/SliderExtensions.cs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System.Threading.Tasks;
1+
using System;
2+
using System.Threading.Tasks;
23
using CoreGraphics;
34
using Microsoft.Extensions.DependencyInjection;
45
using Microsoft.Maui.Graphics.Platform;
@@ -92,10 +93,26 @@ public static async Task UpdateThumbImageSourceAsync(this UISlider uiSlider, ISl
9293
uiSlider.SetThumbImage(null, UIControlState.Normal);
9394
uiSlider.UpdateThumbColor(slider);
9495
}
96+
97+
// On iOS 26+, SetThumbImage() no longer triggers a layout pass that recalculates
98+
// the thumb position at runtime. Explicitly call SetNeedsLayout() to restore this.
99+
if (OperatingSystem.IsIOSVersionAtLeast(26))
100+
{
101+
uiSlider.SetNeedsLayout();
102+
}
95103
}
96104

97105
static CGSize CalculateDefaultThumbSize(UISlider uiSlider)
98106
{
107+
if (uiSlider.Bounds.IsEmpty)
108+
{
109+
var thumbDiameter = uiSlider.IntrinsicContentSize.Height;
110+
if (thumbDiameter > 0)
111+
{
112+
return new CGSize(thumbDiameter, thumbDiameter);
113+
}
114+
}
115+
99116
var trackRect = uiSlider.TrackRectForBounds(uiSlider.Bounds);
100117
var thumbRect = uiSlider.ThumbRectForBounds(uiSlider.Bounds, trackRect, 0);
101118
return thumbRect.Size;

0 commit comments

Comments
 (0)