diff --git a/Xamarin.Forms.Platform.iOS/Renderers/ScrollViewRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/ScrollViewRenderer.cs index bfb24337e..af5fc1a65 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/ScrollViewRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/ScrollViewRenderer.cs @@ -209,23 +209,8 @@ namespace Xamarin.Forms.Platform.iOS { var positionOnScroll = Controller.GetScrollPositionForElement(e.Element as VisualElement, e.Position); - if (positionOnScroll.X < 0) - { - positionOnScroll.X = 0; - } - else if (positionOnScroll.X > ContentSize.Width - Bounds.Size.Width) - { - positionOnScroll.X = ContentSize.Width - Bounds.Size.Width; - } - - if (positionOnScroll.Y < 0) - { - positionOnScroll.Y = 0; - } - else if (positionOnScroll.Y > ContentSize.Height - Bounds.Size.Height) - { - positionOnScroll.Y = ContentSize.Height - Bounds.Size.Height; - } + positionOnScroll.X = positionOnScroll.X.Clamp(0, ContentSize.Width - Bounds.Size.Width); + positionOnScroll.Y = positionOnScroll.Y.Clamp(0, ContentSize.Height - Bounds.Size.Height); switch (ScrollView.Orientation) {